comp.lang.ada
 help / color / mirror / Atom feed
From: "Jean-Pierre Rosen" <rosen@adalog.fr>
Subject: Re: how to know sizeof(int)
Date: Thu, 5 Aug 2004 10:14:15 +0200
Date: 2004-08-05T10:14:15+02:00	[thread overview]
Message-ID: <gpqsec.gp1.ln@skymaster> (raw)
In-Reply-To: 87llguk9k1.fsf@insalien.org

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]


"Ludovic Brenta" <ludovic.brenta@insalien.org> a �crit dans le message de news:87llguk9k1.fsf@insalien.org...
> Indeed, hidden assumptions are evil, and the Enlightened Ones use
> System.Storage_Unit instead of just "8".  Somehow, "8" is too short to
> type and read :)
Sure, but we are in a C context here. Try to explain to a C programmer that a byte does not necessarily have eight bits :-)

> > Note that sizeof is *not* a regular function (a regular function
> > could not have a type as the parameter). It is handled very
> > specially in the C compiler, therefore there is no way you could get
> > to it from another language.
>
> I suppose 'Size is also handled specially by Ada compilers, right?
All attributes are handled specially of course, but it is explicit. The goal of having a special syntax for attributes is to avoid
*hidden* magic, and by the way, it is why it is a good thing that users are not allowed to define their own attributes.
It saves you from interesting question like "what happens if a user defines a function called sizeof?".

-- 
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





  reply	other threads:[~2004-08-05  8:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-04 14:58 how to know sizeof(int) Evangelista Sami
2004-08-04 15:18 ` Eric Jacoboni
2004-08-04 15:26 ` Adrian Knoth
2004-08-04 15:32 ` Jean-Pierre Rosen
2004-08-04 19:06   ` Ludovic Brenta
2004-08-05  8:14     ` Jean-Pierre Rosen [this message]
2004-08-07  4:09       ` Keith Thompson
2004-08-04 21:52   ` Adrian Knoth
2004-08-05  8:16     ` Jean-Pierre Rosen
replies disabled

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