www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/25/06:45:19

Message-ID: <33136A27.265@post.comstar.ru>
Date: Tue, 25 Feb 1997 14:39:35 -0800
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: zager AT post DOT comstar DOT ru
MIME-Version: 1.0
To: DJGPP Mail List <djgpp AT delorie DOT com>
Subject: Re: Zero length array ?
References: <01IFTZ4D6KUIBHA7CW AT mail> <331369DD DOT 4E0F AT post DOT comstar DOT ru>

Hans-Bernhard Broeker wrote:
 >
 > In article <33133A4B DOT 1571 AT post DOT comstar DOT ru> you wrote:
 >
 > > typedef struct
 > > { int hName;
 > >   char szName[0];
 > > } TFoo;
 >
 > > My question is : then I allocate space for MyFoo where actualy
 > > MyFoo->szName points ?
 
 >  gcc does allow zero-length arrays,
 Yes you are right, this feature is documented in gcc.info (see C
 Extensions)
 
 > but that makes your code unportable to other
 > compilers, which is not a very good idea.
 The only CPU I know is Z80 (where GCC don't ported ;) (8086 and 80286
 too)
 So, why you are thinking about some hypothetical compilers then you
have
 gcc at most palforms ???
 
 > Just out of curiosity: did you ever try to compile the code you
posted
 > with 'gcc -O -Wall', and look at the errors and warnings you get?
 Certainly yes!  No warnings noe errors. ;)

-- 
Regards,
Dim Zegebart,
Moscow Russia.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019