Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #14903

Re: warning: string length greater than '509'

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Fri, 23 Dec 2011 04:49:43 -0600
Message-ID <4EF45CC7.7759@mindspring.com> (permalink)
Date Fri, 23 Dec 2011 05:49:43 -0500
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: warning: string length greater than '509'
References <jd1jij$m7g$1@reader1.panix.com>
Content-Type text/plain; charset=iso-8859-1
Content-Transfer-Encoding 8bit
Lines 56
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.156.228.164
X-Trace sv3-v6fO4/DMxihVDSe0WtnNNXw0OZn47NpS4/U/7TZwhFrASfYaU7aZhE4meqLN8iVsim3YYRRzsVKTbfe!ZFa1I9Z4oOHToslFKcHDsfmzwCNTBQZotRCgA1pKGWCH/2jzwurGWMjFUUYTuBkC/LpmxJP/w1Rz!D1u1D3j9DiY=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 3045
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:14903

Show key headers only | View raw


JohnF wrote:
> 
> I like to compile (linux/gcc) with -pedantic -Wall
> and neaten up the code to eliminate all warnings.
> But the following code emits the message
>   warning: string length '1008' is greater than the
>   length '509' ISO C90 compilers are required to support
> and I can't see a neat way around it. The offending
> statement is,
> static  char latexwrapper[16384] =
>         "\\documentclass[10pt]{article}\n"
>         "\\usepackage[latin1]{inputenc}\n"
>         "\\usepackage{amsmath}\n"
>         "\\usepackage{amsfonts}\n"
>         "...lots-more-junk...";
> I could obviously break it up into several smaller
> initializations and strcat() them all at runtime,
> but that (in my opinion) isn't what I meant by "neat".
> It works as is, which is how I'd leave it if that's
> (strcat() several smaller strings at runtime) is the
> only solution. But a straightforward way around the
> warning would be even nicer.

Using strcat might only have the effect of avoiding the warning,
while retaining the portability problem,
which may or may not be acceptable to you.

If you actually want the portability that the warning is reffering to,
and if latexwrapper is supposed to be constant,
and all that you are ever going to do with it, 
is to write it to a file 
or to files such as standard output for example,
then you might try something like
   static  char latexwrapper[33][510] = /* {"",""} */
and use fputs in a loop to do write operations
on 33 strings of acceptable length.

The number (509) appears more than once 
in the C90 standard 
in a related context.

ISO/IEC 9899: 1990

7.9.6 Formatted input/output functions
7.9.6.1 The fprintf function

Environmental limit
    The minimum value for the maximum number of characters
    produced by any single conversion shall be 509.

G.2 Undefined behavior
    — A single conversion by the fprintf function 
      produces more than 509 characters of output (7.9.6.1).

-- 
pete

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

warning: string length greater than '509' JohnF <john@please.see.sig.for.email.com> - 2011-12-23 10:01 +0000
  Re: warning: string length greater than '509' jacob navia <jacob@spamsink.net> - 2011-12-23 11:19 +0100
  Re: warning: string length greater than '509' pete <pfiland@mindspring.com> - 2011-12-23 05:49 -0500
    Re: warning: string length greater than '509' jacob navia <jacob@spamsink.net> - 2011-12-23 13:52 +0100
      Re: warning: string length greater than '509' Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-12-28 03:27 -0800
        Re: warning: string length greater than '509' James Kuyper <jameskuyper@verizon.net> - 2011-12-28 08:16 -0500
        Re: warning: string length greater than '509' Keith Thompson <kst-u@mib.org> - 2011-12-28 13:04 -0800
          Re: warning: string length greater than '509' Tim Rentsch <txr@alumni.caltech.edu> - 2012-01-25 16:47 -0800
    Re: warning: string length greater than '509' JohnF <john@please.see.sig.for.email.com> - 2011-12-23 13:04 +0000
      Re: warning: string length greater than '509' Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-12-23 09:36 -0500
  Re: warning: string length greater than '509' Robert Wessel <robertwessel2@yahoo.com> - 2011-12-23 04:59 -0600
    Re: warning: string length greater than '509' JohnF <john@please.see.sig.for.email.com> - 2011-12-23 12:41 +0000
      Re: warning: string length greater than '509' jt@toerring.de (Jens Thoms Toerring) - 2011-12-23 13:50 +0000
      Re: warning: string length greater than '509' James Kuyper <jameskuyper@verizon.net> - 2011-12-23 09:14 -0500
      Re: warning: string length greater than '509' Robert Wessel <robertwessel2@yahoo.com> - 2011-12-23 12:27 -0600
        Re: warning: string length greater than '509' Seebs <usenet-nospam@seebs.net> - 2011-12-23 19:04 +0000
          Re: warning: string length greater than '509' Robert Wessel <robertwessel2@yahoo.com> - 2011-12-23 16:11 -0600
        New C standard (was Re: warning: string length greater than '509') Keith Thompson <kst-u@mib.org> - 2011-12-23 12:21 -0800
          Re: New C standard (was Re: warning: string length greater than '509') Jens Gustedt <jens.gustedt@loria.fr> - 2011-12-23 22:54 +0100
          Re: New C standard (was Re: warning: string length greater than '509') Robert Wessel <robertwessel2@yahoo.com> - 2011-12-23 16:27 -0600
          Re: New C standard (was Re: warning: string length greater than '509') rudolf <r.thered@gmail.com> - 2011-12-23 15:36 -0800
          new edition of Harbison and Steele? Patrick Scheible <kkt@zipcon.net> - 2011-12-26 18:57 -0800
            Re: new edition of Harbison and Steele? Keith Thompson <kst-u@mib.org> - 2011-12-27 02:48 -0800
              Re: new edition of Harbison and Steele? Patrick Scheible <kkt@zipcon.net> - 2011-12-27 11:45 -0800
        Re: warning: string length greater than '509' JohnF <john@please.see.sig.for.email.com> - 2011-12-24 05:42 +0000
          Re: warning: string length greater than '509' Robert Wessel <robertwessel2@yahoo.com> - 2011-12-24 00:47 -0600
            Re: warning: string length greater than '509' JohnF <john@please.see.sig.for.email.com> - 2011-12-24 08:51 +0000
  Re: warning: string length greater than '509' Stars and Midnight China Blue <chine.bleu@yahoo.com> - 2011-12-23 03:34 -0800
  Re: warning: string length greater than '509' Kaz Kylheku <kaz@kylheku.com> - 2011-12-23 16:48 +0000

csiph-web