comp.lang.ada
 help / color / mirror / Atom feed
* Trailing Underscores (was Re: Problems translating C to Ada)
  1998-09-01  0:00 Problems translating C to Ada Viqar Abbasi
@ 1998-09-01  0:00 ` Robert I. Eachus
  1998-09-03  0:00   ` Samuel Mize
       [not found] ` <35ED511D.2C4A2038@boeing.com>
  1 sibling, 1 reply; 4+ messages in thread
From: Robert I. Eachus @ 1998-09-01  0:00 UTC (permalink / raw)


In article <35EC2FA8.3308@cae.ca> Viqar Abbasi <viqar@cae.ca> writes:

 > Recently gained Ada experience:  
 > Ada9X RM and GNAT 3.09 do not allow underscores at the 
 > end of a procedure / function / variable name.  Why not?

   Because Ada 83 did not.

   Seriously, there were several proposals for extensions to the
variable name syntax discussed at the Salem, Massachusetts meeting.
After several votes, straw and otherwise, there was no clear consensus
on what to do.  (Choosing between options including adding underscores
at the end, treating underscore like another digit, or another
character, allowing leading and trailing underscores, etc.)  Since
there was no clearly acceptable alternative, no change was made.

   If we had been using a different voting procedure, we probably
would have ended up with the most change that a majority found
acceptable.
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Problems translating C to Ada
@ 1998-09-01  0:00 Viqar Abbasi
  1998-09-01  0:00 ` Trailing Underscores (was Re: Problems translating C to Ada) Robert I. Eachus
       [not found] ` <35ED511D.2C4A2038@boeing.com>
  0 siblings, 2 replies; 4+ messages in thread
From: Viqar Abbasi @ 1998-09-01  0:00 UTC (permalink / raw)


Hi there,

I've been using CBIND revision 4 to translate tiny (one page)
C programs into Ada.  I recently noticed a problem that the
CBIND program incorrectly translates matrices.  For example,
in the C file:

 float          my_matrix[3][3];

becomes in Ada:

    type vector_of_c_float_t is
        array(integer range <>)
        of c.float;

    type matrix_of_c_float_t is                              
        array(integer range <>)
        of vector_of_c_float_t(0..2);

    my_matrix: matrix_of_c_float_t(0..2)(0..2);

The problem is with the final line, which should be:
    my_matrix: matrix_of_c_float_t(0..2);

Does anyone know if there is a newer version of CBIND 
out there which corrects this problem.  Or, do you 
recommend I use the "c2ada" tool to fix this problem?
My translations are really small, so I'd rather use
CBIND if I can.  

Thanks!
Viqar

Recently gained Ada experience:  
Ada9X RM and GNAT 3.09 do not allow underscores at the 
end of a procedure / function / variable name.  Why not?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Problems translating C to Ada
       [not found] ` <35ED511D.2C4A2038@boeing.com>
@ 1998-09-02  0:00   ` Ronald Ali
  0 siblings, 0 replies; 4+ messages in thread
From: Ronald Ali @ 1998-09-02  0:00 UTC (permalink / raw)


We have a need to translate c headers to Ada, but I had no
success building c2ada on our Solaris workstation.  We have
now moved over to NT, and my first attempt to build c2ada on
NT has also failed.
Please let me know what platform you are running c2ada on,
and if there is a binary available?

Ronald Ali
Stanford Telecom
732-933-4070 x141
732-933-4088 fax
RonAli@WriteMe.com

On Wed, 2 Sep 1998 14:07:25 GMT, Bill Hodges
<william.m.hodges@boeing.com> wrote:
>
>I used c2ada very successfully.
>I  recommend it if you are having trouble with CBIND.
>
>--
>Bill Hodges
>Boeing Information, Space & Defense Systems
>(253) 773-4315; fax (253) 773-9070
>





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Trailing Underscores (was Re: Problems translating C to Ada)
  1998-09-01  0:00 ` Trailing Underscores (was Re: Problems translating C to Ada) Robert I. Eachus
@ 1998-09-03  0:00   ` Samuel Mize
  0 siblings, 0 replies; 4+ messages in thread
From: Samuel Mize @ 1998-09-03  0:00 UTC (permalink / raw)


In article <EACHUS.98Sep1185958@spectre.mitre.org>,
Robert I. Eachus <eachus@spectre.mitre.org> wrote:
>In article <35EC2FA8.3308@cae.ca> Viqar Abbasi <viqar@cae.ca> writes:
>
> > Recently gained Ada experience:  
> > Ada9X RM and GNAT 3.09 do not allow underscores at the 
> > end of a procedure / function / variable name.  Why not?
>
>   Because Ada 83 did not.
>
>   Seriously, there were several proposals for extensions to the
>variable name syntax discussed at the Salem, Massachusetts meeting.

I wasn't there, but the decision reached makes sense to me.

We want identifiers to be readable and easily distinguished as words
or phrases.  We have mixed case for readability: we can write Dogma or
DOGMA, whatever we find best (if it's an acronym perhaps DOGMA is
better).  We have case-insensitive names so we don't have to
distinguish Dogma from dogma or DogMa.  We have the underscore for
readability, so we can separate words with more than capitalization.
(I know some people prefer CapSeparatedWords, but that's what the
underline is intended for.)

The point is, we're trying to make identifiers look like words or
phrases.  Specifically, we want different identifiers to look like
DIFFERENT phrases.

But Dogma_ and Dogma are the same word.  There's no
human-language-level distinction.

The main reason I've seen for using trailing underscores is to make it
easier to link with languages that add underscores at the ends of
their identifiers.  But this is better handled with pragmas like
Import.

Do you have another reason for wanting trailing underscores?

Best,
Sam Mize

-- 
Samuel Mize -- smize@imagin.net (home email) -- Team Ada
Fight Spam: see http://www.cauce.org/ \\\ Smert Spamonam




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-09-03  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-09-01  0:00 Problems translating C to Ada Viqar Abbasi
1998-09-01  0:00 ` Trailing Underscores (was Re: Problems translating C to Ada) Robert I. Eachus
1998-09-03  0:00   ` Samuel Mize
     [not found] ` <35ED511D.2C4A2038@boeing.com>
1998-09-02  0:00   ` Problems translating C to Ada Ronald Ali

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