Article View: comp.std.c
Article #4378Re: SAS/C++ 6.56 bugs
From: Mike Rubenstein
Date: Sun, 19 Nov 1995 02:26
Date: Sun, 19 Nov 1995 02:26
27 lines
1579 bytes
1579 bytes
arno@yaps.rhein.de (Arno Eigenwillig) wrote: >In article <48iptn$b1q@macondo.dmu.ac.uk>, Richard Perrott writes: > >> 1. strncpy() in string.h does not put a '\0' at the end of the destination >> string if the source string is the same length as the copy length. > >It is defined that way by ANSI. > >> 2. the #defines in ctype.h e.g. toupper() cause problems since the term is >> used more than once, a problem with *s++ terms. > >Of the ANSI functions, only tolower() and toupper() are concerned. >The workaround is to #undef them or parenthesize the function names. >I wonder, though, what the ANSI-C experts think of this. (Hence >x-posting and f'up2.) The standard requires that anything defined as a function in the standard (this includes toupper() and tolower()) behave like a function. In particular (ISO 7.1.7): Any invocation of a library function that is implemented as a macro shall expand to code that evaluates each of its argtuments exactly once, fully protected by parentheses wehre necessary, so it is generally safe to use arbitrary expressions as arguments. Michael M Rubenstein
Technical Details
Message-ID:
<48m4ib$s1d@ixnews5.ix.netcom.com>Path:
arc1-ca.pugleaf.net!ix.netcom.com!netnewsReferences:
<48iptn$b1q@macondo.dmu.ac.uk> <nBvEx*ahe@yaps.rhein.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!ix.netcom.com!netnews From: miker3@ix.netcom.com (Mike Rubenstein) Newsgroups: comp.std.c Subject: Re: SAS/C++ 6.56 bugs Date: Sun, 19 Nov 1995 02:26:38 GMT Organization: Netcom Message-ID: <48m4ib$s1d@ixnews5.ix.netcom.com> References: <48iptn$b1q@macondo.dmu.ac.uk> <nBvEx*ahe@yaps.rhein.de> NNTP-Posting-Host: ix-dc18-25.ix.netcom.com X-NETCOM-Date: Sat Nov 18 6:25:15 PM PST 1995 X-Newsreader: Forte Agent .99b.112