Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: PATCH: fix for smooth_map (PR#991)
Home

[Freeciv-Dev] Re: PATCH: fix for smooth_map (PR#991)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: PATCH: fix for smooth_map (PR#991)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 8 Oct 2001 18:06:25 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Oct 08, 2001 at 11:55:08AM -0400, Jason Dorje Short wrote:
> Greg Wooledge wrote:
> > 
> > Raimar Falke (hawk@xxxxxxxxxxxxxxxxxxxxxxx) wrote:
> > 
> > > >  static void smooth_map(void)
> > > >  {
> > > > +  int new_hmap[map.xsize * map.ysize];
> > >
> > > I think that such constructs aren't allow in C. IMHO the size has to
> > > be a compile time constant. Either I'm wrong and this is ok for local
> > > function variables or it is an gcc extension.
> > 
> > You're correct -- it's not allowed in standard C.  You need to use one
> > of the malloc() family, and free() when you're done.
> 
> Wow, that's too bad.  I guess I'll fix it - and all of the other places
> where I've done the same thing.
> 
> I sometimes forget that gcc does lots of "extensions" to standard C. 
> It's much funner to blame Microsoft for such things.
> 
> Is there some combination of gcc options (-Wnnn) that will get gcc to
> give an error in this case?

From the info page:

   GNU C provides several language features not found in ANSI standard
   C.  (The `-pedantic' option directs GNU CC to print a warning
   message if any of these features is used.)  To test for the
   availability of these features in conditional compilation, check
   for a predefined macro `__GNUC__', which is always defined under
   GNU CC.

and

   `-pedantic'
   Issue all the warnings demanded by strict ISO C and ISO C++; reject
   all programs that use forbidden extensions, and some other programs
   that do not follow ISO C and ISO C++.  For ISO C, follows the
   version of the ISO C standard specified by any `-std' option used.

and

   Some users try to use `-pedantic' to check programs for strict ISO
   C conformance.  They soon find that it does not do quite what they
   want: it finds some non-ANSI practices, but not all--only those for
   which ISO C *requires* a diagnostic, and some others for which
   diagnostics have been added.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Like the ad says, at 300 dpi you can tell she's wearing a
  swimsuit. At 600 dpi you can tell it's wet. At 1200 dpi you
  can tell it's painted on. I suppose at 2400 dpi you can tell
  if the paint is giving her a rash."
    -- Joshua R. Poulson


[Prev in Thread] Current Thread [Next in Thread]