From: Geed AT kong DOT net (exe) Subject: B20: typedef bug? 19 Jan 1999 18:27:17 -0800 Message-ID: <000701ba00e6$4826f260$9d6b1581.cygnus.gnu-win32@d110-1007.rit.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0004_01BA00E6.467BB360" To: This is a multi-part message in MIME format. ------=_NextPart_000_0004_01BA00E6.467BB360 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable typedef char bmp_t[480][640]; void main() { bmp_t*bmp=3Dnew bmp_t; } results in... test.cc: In function `int main(...)': test.cc:4: initialization to `char (*)[480][640]' from `char (*)[640]' This occures in 3 different compilers (including non gnu-cpp), so mabey = typedef was not intended to be used this way. It does appear to be a bogus error though. the only good workaround I found is to create a macro that typecasts = another type #define new2(a) ((a*)(new char[sizeof(a)])) bmp_t*bmp=3Dnew2 (bmp_t); Louie Gosselin ------=_NextPart_000_0004_01BA00E6.467BB360 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
typedef char = bmp_t[480][640];
 
void main() {
  = bmp_t*bmp=3Dnew=20 bmp_t;
}
 
results in...
 
test.cc: In function `int=20 main(...)':
test.cc:4: initialization to `char (*)[480][640]' from = `char=20 (*)[640]'
This occures in 3 different = compilers (including=20 non gnu-cpp), so mabey typedef was not intended to be used this=20 way.
It does appear to be a bogus error=20 though.
 
the only good workaround I found is = to create a=20 macro that typecasts another type
 
#define new2(a) ((a*)(new=20 char[sizeof(a)]))
bmp_t*bmp=3Dnew2 = (bmp_t);
 
 
Louie = Gosselin
------=_NextPart_000_0004_01BA00E6.467BB360-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".