Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!198.186.194.249.MISMATCH!transit3.readnews.com!news-out.readnews.com!news-xxxfer.readnews.com!panix!not-for-mail From: JohnF Newsgroups: comp.lang.c Subject: Re: warning: string length greater than '509' Date: Sat, 24 Dec 2011 05:42:12 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 67 Message-ID: References: NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1324705332 17214 166.84.1.3 (24 Dec 2011 05:42:12 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sat, 24 Dec 2011 05:42:12 +0000 (UTC) User-Agent: tin/2.0.0-20110823 ("Ardenistiel") (UNIX) (NetBSD/5.1 (i386)) Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:14942 Robert Wessel wrote: > JohnF wrote: >> Robert Wessel wrote: >>> JohnF wrote: >>> >>>> warning: string length '1008' is greater than the >>>> length '509' ISO C90 compilers are required to support >>> >>> Compile with: -Wno-overlength-strings >> >>Who knew??? So I took a look at man cc and also found >>-std=gnu99 which also works. Weirdly, though, -std=c99, >>which seems equivalent as described on the manpage, >>emits about a dozen new warnings, including some >>"obviously wrong" (meaning they could be right?) ones >>like "implicit declaration of function 'popen'", even >>though stdio.h is included. (Note: I haven't actually >>tested the executable images created using either switch, >>and certainly not looked for any differences in the >>generated instructions.) > > > As others have pointed out, gnu99 leaves a bunch of commonly used GCC > extensions enabled. > > A word about C99 mode (with or without extensions), though. If C99 > support is a reasonable prerequisite for the targets you're intending > to port to (or if you're writing strictly for the local machine), by > all means, go ahead and use that, there are certainly some useful > additions to the language (and also a few changes). > > But while C89/C90 has been officially superseded by C99 (or actually > C11 as of a couple of weeks ago), there are a significant number of > compilers in the world that have not fully implemented C99 (or any of > C99) while still providing a full C89 implementation. MS's standard > compiler falls into that category, for example, as do many compilers > for embedded targets. > > So if you intend a port to Windows, you'll have to use a compiler > other than MSVC if you use C99 features. If I understand the > situation correctly, Jacob Navia, who has posted in this thread, has > produced such a creature, and would apparently be willing to sell you > a license. The GCC ports for Windows should work too, as would > Intel's ICC. But there are certainly some advantages to using MSVC > for Windows development. Thanks for the additional info. C89 should work fine for everything, except the silly long string initialization. And although I usually try to code in completely portable ansi standard C, this particular program is pretty much Unix only. Maybe I should clarify, it's the gpl'ed program http://www.forkosh.com/mathtex.html that recently got that silly long string due to the enhancement http://www.forkosh.com/mathtex.html?valignment which vertically aligns emitted images precisely ("middle" or "absmiddle" doesn't usually do a decent job). And since it's a one-line build, I don't provide any configure/make-type script, just instructions what to put on the cc line. And I won't bother adding -std to that. But I occasionally get email about -pedantic warnings from sticklers, and so try to eliminate them when it's feasible and reasonably easy. This time it apparently ain't, so the heck with it. The 4095 limit pointed out by Jacob Navia is quite more than I actually need, so there's no actual problem, just the pesky message. And I hoped there might be a tricky way to easily accomplish the equivalent initialization without raising the warning. But I'm not materially changing the code just to deal with it. -- John Forkosh ( mailto: j@f.com where j=john and f=forkosh )