E
Erwin Lindemann
Hi group!
I hope this subject is topical here; if not, I apologize
in advance. Context is, some days ago, in
acticle <[email protected]>, somebody posted
a supposedly portable program here. Later, another poster
noticed it didn't compile with one particular compiler, and
it was suggested to report the problem in another group where
said compiler is topical. Well, out of interest what the problem
might be I did just that, and received the following 3-line
response:
----snip----
1) Read the error message.
2) Read the documentation about the safe C library
3) Use another compiler. As I told you in comp.lang.c gcc is the best
----snip----
The error message is
----snip----
lc -ansic -A -O -c ronu.c -o ronu.obj
Error ronu.c: 62 redefinition of 'ConstraintFailed'
Error c:\lcc\include\safelib.h: 3 Previous definition of 'ConstraintFailed' here
Warning ronu.c: 62 inconsistent linkage for 'ConstraintFailed' previously declared at c:\lcc\include\safelib.h 3
2 errors, 1 warning
1 error
----snip----
Obviously, the code in question uses the identifier
"ContraintFailed", which is already declared/defined(?) in
"safelib.h" (which seems to be included by one of the standard
headers). That part was easy.
Now on to (2). What is "the safe C library" and where can I find
information about it. Is it related to N1135?
Chapter 6 in N1135 mentions 2 macros,
__STDC_LIB_EXT1__
The integer constant 200509L, intended to indicate
conformance to this technical report.
(the compiler in question defines __STDC_LIB_EXT1__ empty)
__STDC_WANT_LIB_EXT1__
* Functions, macros, and types declared or defined in N1135
are unavailable if __STDC_WANT_LIB_EXT1__ is defined as a
macro that expands to the integer constant 0.
* Functions, macros, and types declared or defined in N1135
are available if __STDC_WANT_LIB_EXT1__ is defined as a
macro that expands to the integer constant 1 (or other values
as explained in footnote (2)).
* if __STDC_WANT_LIB_EXT1__ is undefined, things are
implementation-defined.
(the compiler in question does not define __STDC_WANT_LIB_EXT1__ itself)
After reading all this, I'm still very confused. What is the correct
way to compile conforming programs with the "safe C library"?
I tried
#define __STDC_WANT_LIB_EXT1__ 0
at the top of the source file; still the same error.
Is there a different document that does reserve "ConstraintFailed"
from usage in the programmer's name space?
Thanks
I hope this subject is topical here; if not, I apologize
in advance. Context is, some days ago, in
acticle <[email protected]>, somebody posted
a supposedly portable program here. Later, another poster
noticed it didn't compile with one particular compiler, and
it was suggested to report the problem in another group where
said compiler is topical. Well, out of interest what the problem
might be I did just that, and received the following 3-line
response:
----snip----
1) Read the error message.
2) Read the documentation about the safe C library
3) Use another compiler. As I told you in comp.lang.c gcc is the best
----snip----
The error message is
----snip----
lc -ansic -A -O -c ronu.c -o ronu.obj
Error ronu.c: 62 redefinition of 'ConstraintFailed'
Error c:\lcc\include\safelib.h: 3 Previous definition of 'ConstraintFailed' here
Warning ronu.c: 62 inconsistent linkage for 'ConstraintFailed' previously declared at c:\lcc\include\safelib.h 3
2 errors, 1 warning
1 error
----snip----
Obviously, the code in question uses the identifier
"ContraintFailed", which is already declared/defined(?) in
"safelib.h" (which seems to be included by one of the standard
headers). That part was easy.
Now on to (2). What is "the safe C library" and where can I find
information about it. Is it related to N1135?
Chapter 6 in N1135 mentions 2 macros,
__STDC_LIB_EXT1__
The integer constant 200509L, intended to indicate
conformance to this technical report.
(the compiler in question defines __STDC_LIB_EXT1__ empty)
__STDC_WANT_LIB_EXT1__
* Functions, macros, and types declared or defined in N1135
are unavailable if __STDC_WANT_LIB_EXT1__ is defined as a
macro that expands to the integer constant 0.
* Functions, macros, and types declared or defined in N1135
are available if __STDC_WANT_LIB_EXT1__ is defined as a
macro that expands to the integer constant 1 (or other values
as explained in footnote (2)).
* if __STDC_WANT_LIB_EXT1__ is undefined, things are
implementation-defined.
(the compiler in question does not define __STDC_WANT_LIB_EXT1__ itself)
After reading all this, I'm still very confused. What is the correct
way to compile conforming programs with the "safe C library"?
I tried
#define __STDC_WANT_LIB_EXT1__ 0
at the top of the source file; still the same error.
Is there a different document that does reserve "ConstraintFailed"
from usage in the programmer's name space?
Thanks