I would like to second that.

With some of the new MS compilers, you have to define a symbol
_CRT_SECURE_NO_DEPRECATE; if not, you get warning messages
on every call of strcpy, sprintf and so on.

While I agree that the NULL terminated strings and the C string library
are a bad idea from the start (coming from PDP-x and Unix, AFAIK),
we have to live with it, because it's standard and portable. And, if
handled carefully, you can write safe programs, even if you use these
"unsafe" functions. For example, all my programs use a standard function
handling argc/argv positional parameters, giving the possibility for
keyword parameters with defaults, maximum lengths, type checks
and so on, and all buffer overruns etc. due to wrong parameters
are impossible, if you use this function.

Kind regards

Bernd



McKown, John schrieb:
OPINION TIME!

The "safe" versions are not safer than using some of the others which include the length of the destination buffer. Such as strncpy, strncmp, and so on. The strn... functions are multiplatform and standard. The str..._s functions, from what I have read on the Web, are a Microsoft invention. They are not ISO or ANSI standard functions, but are being considered. And, according to one person, were invented by MS strictly as a way to make it more difficult to port code using them to other systems.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to