July 31, 2003 Puzzling Digital Mars C++ Behavior | ||||
---|---|---|---|---|
| ||||
Hello: I discovered a behavior of the Digital Mars compiler that has me puzzled. The small program reproduced below compiles without error as a .c program but produces an error when compiled as a .cpp program, namely: SC -cpp -r -Ae -Ar -Aa -mx -f -S -s -3 -a4 -c -oFPTR2.obj FPTR2.cpp int (* t(int ix))(int *); ^ FPTR2.cpp(9) : Error: '(' expected following simple type name The startling thing is that other compilers like DJ Delorie's DJGPP (ver 2.81), Borland's BC++4.5 (bcc -ml -3 -k -N fptr2.cpp), and even (alas) Microsoft's Visual C++ 4 compile this .cpp code without a complaint. I would be immensely appreciative if you would clarify if this is some new C++ language behavior or if this is some kind of bug. Incidentally, replacing the declaration for the t-function with: T t(int ix); //--FORWARD REFERENCE function prototype where T is defined as: typedef int (*T)(int *k); makes all the Digital Mars errors go away... Thanks in advance for any assistance, Stephen Zamoscianyk byf9vh@cs.com |
July 31, 2003 Re: Puzzling Digital Mars C++ Behavior | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stephen Zamoscianyk | doh! you forgot the source =) "Stephen Zamoscianyk" <Stephen_member@pathlink.com> wrote in message news:bga4g8$2usm$1@digitaldaemon.com... > Hello: > > I discovered a behavior of the Digital Mars compiler that has me puzzled. The small program reproduced below compiles without error as a .c program but produces an error when compiled as a .cpp program, namely: > > SC -cpp -r -Ae -Ar -Aa -mx -f -S -s -3 -a4 -c -oFPTR2.obj FPTR2.cpp > int (* t(int ix))(int *); > ^ > FPTR2.cpp(9) : Error: '(' expected following simple type name > > The startling thing is that other compilers like DJ Delorie's DJGPP (ver 2.81), > Borland's BC++4.5 (bcc -ml -3 -k -N fptr2.cpp), and even (alas) Microsoft's > Visual C++ 4 compile this .cpp code without a complaint. I would be immensely > appreciative if you would clarify if this is some new C++ language behavior or > if this is some kind of bug. > > Incidentally, replacing the declaration for the t-function with: > T t(int ix); //--FORWARD REFERENCE function prototype > where T is defined as: typedef int (*T)(int *k); > makes all the Digital Mars errors go away... > > Thanks in advance for any assistance, > > Stephen Zamoscianyk > byf9vh@cs.com > > |
Copyright © 1999-2021 by the D Language Foundation