[prev in list] [next in list] [prev in thread] [next in thread]
List: hpux-cxx-dev
Subject: Re: CXX-DEV: Compile error : Type name expected in typedef declaration on aCC HPUX 11.0
From: Dennis Handly <dhandly () cup ! hp ! com>
Date: 2008-02-02 2:15:36
Message-ID: 200802020215.SAA23808 () hpcll183 ! hp ! com
[Download RAW message or body]
>From: PoWah Wong <wong_powah@yahoo.ca>
>How to fix the compile errors? I do not see any error in the typedef.
You are using illegal C style coding for enums.
>aCC -D_RWSTD_MULTI_THREAD -mt +Z +p -AA -AP
^^^^^^^
You shouldn't be doing this. Also, -D_RWSTD_MULTI_THREAD isn't valid for
-AP. (But -mt will get the right -D.)
Error 667: Type name expected in typedef declaration.
Because you used +p, future error 667 is an error.
32 typedef enum CmdObjTyp { CmdObjTyp_TokenCommand, CmdObjTyp_ServerCommand };
33 typedef enum UtilTyp { UtilTyp_Command, UtilTyp_Response };
This is basically saying that when you use a typedef, you must have a name,
not just a tag or enumerators.
The proper C++ way to code this is without a stinkin' typedef:
enum CmdObjTyp { CmdObjTyp_TokenCommand, CmdObjTyp_ServerCommand };
if you want it to work for C too, you use a separate typedef:
enum CmdObjTyp { CmdObjTyp_TokenCommand, CmdObjTyp_ServerCommand };
/* Rotten C makes make me add a typedef because tags are in a separate
namespace. What a rotten language. ;-) */
typedef enum CmdObjTyp CmdObjTyp;
You can of course combine the two but that wouldn't leave room for that
comment. :-)
_________________________________________________________________
To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
with the message UNSUBSCRIBE cxx-dev
_________________________________________________________________
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic