Link to home
Start Free TrialLog in
Avatar of lunatik
lunatik

asked on

Delphi Types.

I am new to delphi, however I am familiar to C++. I am trying to learn Delphi, but I can't find an equvalant for enum typedefs. Could someone please tell me what the equivalant is.
Avatar of simonet
simonet
Flag of Brazil image

C to Pascal

 C type              Pascal type
-------------------------------
 unsigned char       byte
 char                char
 char name[arSize]   array [0..arSize - 1] of Char
 int                 integer
 unsigned int        word
 long                longint
 unsigned long       longint
 float               single
 double              double
 char far *          PChar
 char *              PChar if large memory model, Word in small and medium
 SomeType far *      Var aName: SomeType
                     or PSomeType (type PSomeType = ^SomeType) if you

                     need the option to pass Nil as a value
 struct              record
 union               record with variants
 enum                enumerated type with compiler switch $Z+ set (default is $Z-!)

An Enum typedef is something like

Type
  TMyEnum = (meEnum1, meEnum2, me Enum3);

Yours,

Alex
Athena's Place: http://www.bhnet.com.br/~simonet



ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kjteng
kjteng

Read the help on "enumerated type"
example:

type
  Suit = (Club, Diamond, Heart, Spade);
That list didn't look too good in Arial. Sorry about that.

Alex
Avatar of lunatik

ASKER

What if the enum has something like

type
 tdef = ( a = b, dog, cat);

the compiler gives an error for the a = b. What do you do in that instance.
Raymond, that is basically what I said.

Alex
Humpf.
Avatar of lunatik

ASKER

Sorry. C and C++ is all I know. That is why I am trying to learn Delphi. It is just confusing trying to do the conversions. It does help thanks.

Jason
Simonet: Such timing! We both posted at 10:29. The funny thing is that when I posted my answer, your comment didn't come up, which is really strange as it appears your comment is before mine.

Perhaps EE needs to time posts to the second :-)

Cheers,

Raymond.

Avatar of lunatik

ASKER

hehehe. agreed