www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Typedefs

↑ ↓ ← "John Lance" <JDLance prodigy.net> writes:
I am trying to do a typedef that I used to be able to do with another
compiler.

it is:

typedef char[80] char80;

with the result to create a type that causes the compiler to
create/reference an 80 character sized memory space of type char.

I think I may have the syntax wrong, but can the above be done with the
DigitalMars compiler?

I have done

typedef struct {
    char  item[80];
} char80;

but this is not so simple under some circumstances in accessing the data.
With byte alignment, the above struct works fine though with many functions
that use void * or with casting (ugh).

What say you folks to this and am I too far left or right of standards?
Jun 01 2002
↑ ↓ → Jan Knepper <jan smartsoft.cc> writes:
Try:

typedef char          char80 [ 80 ];

Jan



John Lance wrote:

 I am trying to do a typedef that I used to be able to do with another
 compiler.

 it is:

 typedef char[80] char80;

 with the result to create a type that causes the compiler to
 create/reference an 80 character sized memory space of type char.

 I think I may have the syntax wrong, but can the above be done with the
 DigitalMars compiler?

 I have done

 typedef struct {
     char  item[80];
 } char80;

 but this is not so simple under some circumstances in accessing the data.
 With byte alignment, the above struct works fine though with many functions
 that use void * or with casting (ugh).

 What say you folks to this and am I too far left or right of standards?

Jun 01 2002