39 <li id="GUID-304064B6-D603-56C1-9951-8FFD4CD91E4E"><p>Supporting pre-ANSI |
39 <li id="GUID-304064B6-D603-56C1-9951-8FFD4CD91E4E"><p>Supporting pre-ANSI |
40 C compilers. </p> </li> |
40 C compilers. </p> </li> |
41 <li id="GUID-7A765051-395B-5B7A-A71D-C44F5DC00ED4"><p>Passing ANSI or POSIX |
41 <li id="GUID-7A765051-395B-5B7A-A71D-C44F5DC00ED4"><p>Passing ANSI or POSIX |
42 conformance test suites. </p> </li> |
42 conformance test suites. </p> </li> |
43 <li id="GUID-01B46F4E-E6DD-5CD9-8B09-E9D169D961B4"><p>Supporting POSIX-style |
43 <li id="GUID-01B46F4E-E6DD-5CD9-8B09-E9D169D961B4"><p>Supporting POSIX-style |
44 tools executed from a shell. Symbian platform neither provides a shell nor |
44 tools executed from a shell. The Symbian platform neither provides a shell |
45 does it provide a advanced text console. </p> </li> |
45 nor does it provide a advanced text console. </p> </li> |
46 <li id="GUID-12B49D44-453B-5BC6-826C-23B305C43003"><p>Being the C API for |
46 <li id="GUID-12B49D44-453B-5BC6-826C-23B305C43003"><p>Being the C API for |
47 Symbian platform. For example, STDLIB does not provide any new C functions |
47 the Symbian platform. For example, STDLIB does not provide any new C functions |
48 for supporting threads or active schedulers. </p> </li> |
48 for supporting threads or active schedulers. </p> </li> |
49 <li id="GUID-B8292CEE-EC88-503F-8F8B-3EE2F643D524"><p>Providing new C++ interfaces. |
49 <li id="GUID-B8292CEE-EC88-503F-8F8B-3EE2F643D524"><p>Providing new C++ interfaces. |
50 The public API for STDLIB is the C function by itself, and almost no aspects |
50 The public API for STDLIB is the C function by itself, and almost no aspects |
51 of the C++ implementation are exposed, even to C++ programmers. </p> </li> |
51 of the C++ implementation are exposed, even to C++ programmers. </p> </li> |
52 </ul> </section> |
52 </ul> </section> |
53 <section><title>Required Background </title> <p>The understanding on the following |
53 <section id="GUID-EE492687-97FC-4B0E-9E33-64B39DE93F49"><title>Required Background </title> <p>The understanding on the following |
54 are required prior to implementing STDLIB: </p> <p><b>Similarities between |
54 are required prior to implementing STDLIB: </p> <p><b>Similarities between |
55 STDLIB and the ANSI standard </b> </p> <ul> |
55 STDLIB and the ANSI standard </b> </p> <ul> |
56 <li id="GUID-177C458B-84C1-5BBA-A14A-A228DF249C18"><p>Many ANSI standard functions |
56 <li id="GUID-177C458B-84C1-5BBA-A14A-A228DF249C18"><p>Many ANSI standard functions |
57 have been implemented, including all those in <codeph>stdio.h</codeph> and <codeph>math.h</codeph>. |
57 have been implemented, including all those in <codeph>stdio.h</codeph> and <codeph>math.h</codeph>. |
58 The functions which have been implemented are those in the STDLIB header files |
58 The functions which have been implemented are those in the STDLIB header files |
59 whose prototypes are preceded by the <codeph>IMPORT_C</codeph> macro. </p> </li> |
59 whose prototypes are preceded by the <codeph>IMPORT_C</codeph> macro. </p> </li> |
60 <li id="GUID-D807BFE5-B6DC-59D5-9C69-EB53FC79B6CB"><p>STDLIB's maths library, <codeph>math.h</codeph>, |
60 <li id="GUID-D807BFE5-B6DC-59D5-9C69-EB53FC79B6CB"><p>STDLIB's maths library, <codeph>math.h</codeph>, |
61 provides the mandatory ANSI maths functions. Most of these use the underlying |
61 provides the mandatory ANSI maths functions. Most of these use the underlying |
62 Symbian platform maths functions, encapsulated by the <codeph>Math</codeph> class. </p> </li> |
62 Symbian platform maths functions, encapsulated by the <codeph>Math</codeph> class. </p> </li> |
63 <li id="GUID-7379EE4C-D9EF-5846-BA73-6BF628A404CA"><p>Many functions, including <codeph>bsearch()</codeph>, <codeph>qsort()</codeph>, <codeph>memcpy()</codeph> and <codeph>tolower()</codeph> are more than a call to a corresponding function |
63 <li id="GUID-7379EE4C-D9EF-5846-BA73-6BF628A404CA"><p>Many functions, including <codeph>bsearch()</codeph>, <codeph>qsort()</codeph>, <codeph>memcpy()</codeph> and <codeph>tolower()</codeph> are more than a call to a corresponding function |
64 provided by Symbian platform. In many cases, this function may be found in |
64 provided by the Symbian platform. In many cases, this function may be found |
65 Symbian's <codeph>User</codeph> class. For example, <codeph>malloc()</codeph> and <codeph>free()</codeph> simply |
65 in Symbian's <codeph>User</codeph> class. For example, <codeph>malloc()</codeph> and <codeph>free()</codeph> simply |
66 call <codeph>User::Alloc()</codeph> and <codeph>User::Free()</codeph> respectively. </p> </li> |
66 call <codeph>User::Alloc()</codeph> and <codeph>User::Free()</codeph> respectively. </p> </li> |
67 </ul> <p><b>Differences between STDLIB and ANSI and POSIX </b> </p> <ul> |
67 </ul> <p><b>Differences between STDLIB and ANSI and POSIX </b> </p> <ul> |
68 <li id="GUID-09D4CAF0-4427-52E1-BE90-C1C524AB13E3"><p>The STDLIB implementation |
68 <li id="GUID-09D4CAF0-4427-52E1-BE90-C1C524AB13E3"><p>The STDLIB implementation |
69 of <codeph>printf()</codeph> does not take into account the format specifier |
69 of <codeph>printf()</codeph> does not take into account the format specifier |
70 for floating point values. Instead, the implementation uses <codeph>TDes8::Format()</codeph> with |
70 for floating point values. Instead, the implementation uses <codeph>TDes8::Format()</codeph> with |
71 a Symbian platform format specifier which is derived from the style, width |
71 a Symbian platform format specifier which is derived from the style, width |
72 and precision of the original <codeph>printf()</codeph> specifier. The result |
72 and precision of the original <codeph>printf()</codeph> specifier. The result |
73 does not obey the rules for ANSI <codeph>printf()</codeph> for some combinations |
73 does not obey the rules for ANSI <codeph>printf()</codeph> for some combinations |
74 of number width and precision, and formats the numbers using the thousands |
74 of number width and precision, and formats the numbers using the thousands |
75 separator taken from the Symbian platform locale; see class <codeph>TLocale</codeph>. </p> </li> |
75 separator taken from the Symbian platform locale; see class <codeph>TLocale</codeph>. </p> </li> |
76 <li id="GUID-45507BF5-C062-5FF4-BC51-F2B77174C072"><p>Symbian platform identifies |
76 <li id="GUID-45507BF5-C062-5FF4-BC51-F2B77174C072"><p>The Symbian platform |
77 some errors as being fundamental programming errors and will abruptly terminate |
77 identifies some errors as being fundamental programming errors and will abruptly |
78 the offending thread (referred to as a panic). POSIX never does this and will |
78 terminate the offending thread (referred to as a panic). POSIX never does |
79 always return error conditions instead (though some errors will result in |
79 this and will always return error conditions instead (though some errors will |
80 signals, e.g., segmentation faults). </p> </li> |
80 result in signals, e.g., segmentation faults). </p> </li> |
81 <li id="GUID-5FD1D372-3514-5F31-AA92-1F6F5D023A75"><p>POSIX processes exist |
81 <li id="GUID-5FD1D372-3514-5F31-AA92-1F6F5D023A75"><p>POSIX processes exist |
82 in a hierarchy with children inheriting resources from their parents — the |
82 in a hierarchy with children inheriting resources from their parents — the |
83 "fork and exec" model of process creation. In Symbian platform, processes |
83 "fork and exec" model of process creation. On the Symbian platform, processes |
84 have no association whatsoever with the thread which created them. They are |
84 have no association whatsoever with the thread which created them. They are |
85 created by constructing a fresh instance of an executable image. </p> </li> |
85 created by constructing a fresh instance of an executable image. </p> </li> |
86 <li id="GUID-868CC232-9A8F-5764-9499-8B39D3A1DF33"><p>Symbian platform provides |
86 <li id="GUID-868CC232-9A8F-5764-9499-8B39D3A1DF33"><p>The Symbian platform |
87 limited text console support, intended for debugging of low-level components. </p> </li> |
87 provides limited text console support, intended for debugging of low-level |
|
88 components. </p> </li> |
88 <li id="GUID-04209D36-F963-5115-8E44-870AF9E16719"><p>An open file in the |
89 <li id="GUID-04209D36-F963-5115-8E44-870AF9E16719"><p>An open file in the |
89 POSIX system is a process wide resource that can also be inherited by child |
90 POSIX system is a process wide resource that can also be inherited by child |
90 processes. In Symbian platform each thread within a process has separate resources |
91 processes. On the Symbian platform each thread within a process has separate |
91 within the shared process address space, and open files are private to a given |
92 resources within the shared process address space, and open files are private |
92 thread. </p> </li> |
93 to a given thread. </p> </li> |
93 <li id="GUID-157AB2F3-DE12-5A5F-8EA3-3A5E57CECAD9"><p>Open POSIX files are |
94 <li id="GUID-157AB2F3-DE12-5A5F-8EA3-3A5E57CECAD9"><p>Open POSIX files are |
94 inherently shareable, so multiple processes can write to the same file simultaneously. |
95 inherently shareable, so multiple processes can write to the same file simultaneously. |
95 In Symbian platform, open files are inherently non-shareable, and even the |
96 On the Symbian platform, open files are inherently non-shareable, and even |
96 thread which has the file open is only allowed one outstanding write operation |
97 the thread which has the file open is only allowed one outstanding write operation |
97 at a time. For more information on files, see the <codeph>RFile</codeph> class. </p> </li> |
98 at a time. For more information on files, see the <codeph>RFile</codeph> class. </p> </li> |
98 <li id="GUID-D6CE165D-1AC7-50B8-8204-35C074F51079"><p>Symbian platform does |
99 <li id="GUID-D6CE165D-1AC7-50B8-8204-35C074F51079"><p>The Symbian platform |
99 not support global data in DLLs. To overcome this, STDLIB uses a structure, <codeph>_reent</codeph> (declared |
100 does not support global data in DLLs. To overcome this, STDLIB uses a structure, <codeph>_reent</codeph> (declared |
100 in <codeph>reent.h</codeph>) an instance of which is allocated to each thread |
101 in <codeph>reent.h</codeph>) an instance of which is allocated to each thread |
101 to hold the <codeph>errno</codeph> value, some "static data areas" used by |
102 to hold the <codeph>errno</codeph> value, some "static data areas" used by |
102 functions such as <codeph>ctime()</codeph>, and the STDIO data structures. </p> </li> |
103 functions such as <codeph>ctime()</codeph>, and the STDIO data structures. </p> </li> |
103 <li id="GUID-84F0AAF4-BB2B-568A-883D-46656B829C62"><p>Symbian platform has |
104 <li id="GUID-84F0AAF4-BB2B-568A-883D-46656B829C62"><p>The Symbian platform |
104 different client classes for each type of resource: files, sockets and the |
105 has different client classes for each type of resource: files, sockets and |
105 console are all different and have different APIs. POSIX file descriptors |
106 the console are all different and have different APIs. POSIX file descriptors |
106 can refer to all of these different resources and have a common API (though |
107 can refer to all of these different resources and have a common API (though |
107 many functions will actually only work on socket file descriptors). </p> </li> |
108 many functions will actually only work on socket file descriptors). </p> </li> |
108 <li id="GUID-15A73AC5-5065-50E9-8B78-16AFD918565E"><p>Symbian platform processes |
109 <li id="GUID-15A73AC5-5065-50E9-8B78-16AFD918565E"><p>The Symbian platform |
109 do not have a notion of a current working directory. The closest notion is |
110 processes do not have a notion of a current working directory. The closest |
110 the session path, as set and retrieved by class <codeph>RFs</codeph>. </p> </li> |
111 notion is the session path, as set and retrieved by class <codeph>RFs</codeph>. </p> </li> |
111 <li id="GUID-2BCF79DA-66B0-5407-A4E5-ACE41541BAF8"><p>Symbian platform does |
112 <li id="GUID-2BCF79DA-66B0-5407-A4E5-ACE41541BAF8"><p>The Symbian platform |
112 not have a way of pre-empting a thread and causing it to execute a different |
113 does not have a way of pre-empting a thread and causing it to execute a different |
113 piece of code, so there is no true equivalent of a POSIX signal or signal |
114 piece of code, so there is no true equivalent of a POSIX signal or signal |
114 handler. </p> </li> |
115 handler. </p> </li> |
115 </ul> <p><b>Exclusions in STDLIB </b> </p> <p>Symbian has no plans to provide |
116 </ul> <p><b>Exclusions in STDLIB </b> </p> <p>Symbian has no plans to provide |
116 the following in the C Standard Library: </p> <ul> |
117 the following in the C Standard Library: </p> <ul> |
117 <li id="GUID-411B0B35-7705-5448-AE73-BAFDEDC538E2"><p>float-sized maths operations. |
118 <li id="GUID-411B0B35-7705-5448-AE73-BAFDEDC538E2"><p>float-sized maths operations. |