Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
From: w.f.alexander@attbi.com (Bill Alexander)
Subject: CXX Compiler Barfs on traditional C cast
Date: 15 Aug 2003 15:53:27 -0700	[thread overview]
Message-ID: <4ae5eb22.0308151453.45feb80@posting.google.com> (raw)

Imagine I have the following code:

#include <stdio.h>
typedef struct { int a ; int b; int c; } foo;
#define FOOBLD(x,y,z) ((foo){(x),(y),(z)})
int main(void)
{
    foo bar;
    bar = FOOBLD(1,2,3);
    printf("%d %d %d\n", bar.a, bar.b, bar.c);
    return 0;
}

Say I save the file under two names:  test.c and test.cc.  Under Tru64
5.0A with CXX (whatever the stock revision is), I compile both files
with:

cxx test.c
cxx test.cc

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.

I can't reproduce this with other OS's compilers, and don't see any
other references on the 'net to this problem.

I need to get something like this working in order to remain
compatible with a large body of legacy code.

Does anyone have an idea about what I'm missing here?

Thanks in advance.

- Bill


             reply	other threads:[~2003-08-15 22:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15 22:53 Bill Alexander [this message]
2003-08-15 22:56 ` CXX Compiler Barfs on traditional C cast Falk Hueffner
2003-08-18 17:04   ` Bill Alexander
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox