[svlug] Another Gcc/C question on linux vs other Unices
marc_news at vasoftware.com
Fri Jun 14 18:01:26 PDT 2002
On Fri, Jun 14, 2002 at 06:00:09PM -0700, Jeffrey Siegal wrote:
> Marc MERLIN wrote:
> > Mmmh, so even though it works on my system, with linux and gcc, gcc on
> > darwin may try to write in the contructed string.
> This is very unlikely. The above warning about the libraries writing to
> strings was written for legacy systems using an ancient C library.
> Ever since ANSI C (10+ years now) the format string for scanf has been
> defined as "const char *" which means it is illegal for the library
> routine to write to it. No modern C library will write to it.
Ah, ok, good to know.
> > I'll add -fwritable-strings, it can't hurt...
> I advise against it. This means that the strings are placed into
> writable memory, which means they probably won't be shared across
> multiple instances of the program (even if the strings themselves aren't
> modified and are could be shared by a copy-on-write scheme, they'll be
> sharing pages with other writable globals in memory which do get
> written, which means they won't be shared).
Ok, so we're not closer as to why the darwin gcc complains on ##, but I
guess it doesn't matter since I can safely remove it.
"A mouse is a device used to point at the xterm you want to type in" - A.S.R.
Microsoft is to operating systems & security ....
.... what McDonalds is to gourmet cooking
Home page: http://marc.merlins.org/ | Finger marc_f at merlins.org for PGP key
More information about the svlug