comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey Creem" <jeff@thecreems.com>
Subject: Re: Ada to C Question
Date: Sat, 12 Apr 2003 14:53:21 GMT
Date: 2003-04-12T14:53:21+00:00	[thread overview]
Message-ID: <xLVla.157031$OV.239144@rwcrnsc54> (raw)
In-Reply-To: 2a159604.0304120643.39f77838@posting.google.com

I suspect you are going to have to add ugly prefixes to all of the members
of the enums.

(e.g
  typedef enum { mtYt_MyType, mtYt_YourType} myTypeYourType;
 )

or something similar.

You will run into similar problems all over the place with overloaded
procedures and even
procedures of the same name in different packages since the C namespace is
global and .h files
are nothing like Ada specs.


There are (commercial/proprietary) tools that can translate from Ada to C.
While they may not do
a perfect job it might be a good starting point.

Even doing a hand translation, you are likely to have some issues since the
code will end up
being structures with an Ada bias which C programmers who work on your code
in the future
will not like.

For instance, it is likely that you may end up with descriptive variable
names and
well structured code.. C programmers hate that :)  (Flames to personal
e-mail only..)

"MPowell" <mpowell_jr@hotmail.com> wrote in message
news:2a159604.0304120643.39f77838@posting.google.com...
> Perhaps I'm in the wrong forum but I doing some translation from Ada
> to C.
> I've noticed in Ada you can do things like.
>
>   type MYTYPE_YOURTYPE      is (MyType,                         -- 0
>                                 YourType);                       -- 1
>
>   type YOURTYPE_MYTYPE     is (YourType,                       -- 0
>                                 MyType);                        -- 1
>
>
>
>
>   typedef enum { MyType,
>                  YourType } MYTYPE_YOURTYPE ;
>
>
> Obviously if I typedef on YOURTYPE_MYTYPE the compiler complains so
> I'm not sure how to handle this?





  reply	other threads:[~2003-04-12 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-12 14:43 Ada to C Question MPowell
2003-04-12 14:53 ` Jeffrey Creem [this message]
2003-04-12 17:18   ` MPowell
2003-04-12 19:16     ` Larry Kilgallen
2003-04-12 19:43 ` tmoran
     [not found]   ` <2a159604.0304121850.2820b67f@posting.google.com>
2003-04-13  5:37     ` Hyman Rosen
2003-04-13  6:05     ` tmoran
2003-04-13 11:34       ` Larry Kilgallen
2003-04-13 13:38       ` MPowell
replies disabled

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