From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,8a2df0e0ea806c7f X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2003-08-18 10:04:26 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: w.f.alexander@attbi.com (Bill Alexander) Newsgroups: comp.unix.tru64 Subject: Re: CXX Compiler Barfs on traditional C cast Date: 18 Aug 2003 10:04:25 -0700 Organization: http://groups.google.com/ Message-ID: <4ae5eb22.0308180904.64dbd53d@posting.google.com> References: <4ae5eb22.0308151453.45feb80@posting.google.com> <87wudebkdo.fsf@student.uni-tuebingen.de> NNTP-Posting-Host: 208.19.29.104 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1061226266 21691 127.0.0.1 (18 Aug 2003 17:04:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 18 Aug 2003 17:04:26 GMT Xref: archiver1.google.com comp.unix.tru64:10706 Bummer! But thanks for the lesson. I guess I've started thinking of c99 as "traditional" and didn't even consider this. I must be getting lazy. - Bill Falk Hueffner wrote in message news:<87wudebkdo.fsf@student.uni-tuebingen.de>... > w.f.alexander@attbi.com (Bill Alexander) writes: > > > #define FOOBLD(x,y,z) ((foo){(x),(y),(z)}) > > > > The .c version works perfectly and as I'd expect in traditional C. > > The .cc version has a compiler failure with something like: > > "error: expected expression" where the macro with the cast shows up. > > This is not a "traditional cast". It's a compound literal. This was > only introduced in C99, whereas C++ is based on C89. Therefore, the > C++ compiler is correct in rejecting it.