R
Robert Latest
Hello,
generally I stick with C89, but C99 is useful at times, such as the
snprintf() function.
To use that function within an otherwise C89-conforming program, I just put
the proper prototype into my program. The linker links against the C99
library, so everything runs through without error or warning. My question
is: Is this good practice?
I can't see any problems because:
1. CC without C99 header, LD against C99 lib -> no problem
2. CC with C99 header, LD against C99 lib -> no problem
3. CC with with non-standard header (snprintf() defined
in some other way) -> compiler error
4. CC without non-standard header, LD against non-standard
lib -> runtime error
Only the last case is a problem, but that would be such a profoundly goofy
implementation of some non-C language that I wouldn't have to worry about
it.
Am I right?
robert
generally I stick with C89, but C99 is useful at times, such as the
snprintf() function.
To use that function within an otherwise C89-conforming program, I just put
the proper prototype into my program. The linker links against the C99
library, so everything runs through without error or warning. My question
is: Is this good practice?
I can't see any problems because:
1. CC without C99 header, LD against C99 lib -> no problem
2. CC with C99 header, LD against C99 lib -> no problem
3. CC with with non-standard header (snprintf() defined
in some other way) -> compiler error
4. CC without non-standard header, LD against non-standard
lib -> runtime error
Only the last case is a problem, but that would be such a profoundly goofy
implementation of some non-C language that I wouldn't have to worry about
it.
Am I right?
robert