comp.lang.ada
 help / color / mirror / Atom feed
* Normalize_Scalars
@ 2007-02-07 13:33 Maciej Sobczak
  2007-02-07 13:59 ` Normalize_Scalars gautier_niouzes
  0 siblings, 1 reply; 8+ messages in thread
From: Maciej Sobczak @ 2007-02-07 13:33 UTC (permalink / raw)


Hi,

pragma Normalize_Scalars;
procedure Hello is
begin
    null;
end Hello;

$ gnatmake hello
gnatgcc -c hello.adb
gnatbind -x hello.ali
error: some but not all files compiled with Normalize_Scalars

files compiled with Normalize_Scalars
   hello.adb

files compiled without Normalize_Scalars
   s-stalib.adb
   system.ads
   s-memory.adb
   ada.ads
   a-except.adb
   a-elchha.adb
   interfac.ads
   s-exctab.adb
   s-htable.adb
   s-soflin.adb
   s-mastop.adb
   s-maccod.ads
   s-stoele.adb
   s-except.ads
   s-parame.adb
   s-secsta.adb
   s-stache.adb
   s-traceb.adb
   s-unstyp.ads
   s-traent.adb
   s-crtl.ads
gnatmake: *** bind failed.

Wow.

I guess I have to recompile the world to be able to benefit from 
Normalize_Scalars.
Any fast path for dummies or should I be disappointed? :-)

-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



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

* Re: Normalize_Scalars
  2007-02-07 13:33 Normalize_Scalars Maciej Sobczak
@ 2007-02-07 13:59 ` gautier_niouzes
  2007-02-07 14:15   ` Normalize_Scalars gautier_niouzes
  0 siblings, 1 reply; 8+ messages in thread
From: gautier_niouzes @ 2007-02-07 13:59 UTC (permalink / raw)


> I guess I have to recompile the world to be able to benefit from Normalize_Scalars.
> Any fast path for dummies or should I be disappointed? :-)

In a configuration pragmas file I have:

pragma Initialize_Scalars;
-- pragma Normalize_Scalars; -- For all units!

Probably it is a thing to look at.
HTH
Gautier




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

* Re: Normalize_Scalars
  2007-02-07 13:59 ` Normalize_Scalars gautier_niouzes
@ 2007-02-07 14:15   ` gautier_niouzes
  2007-02-07 14:43     ` Normalize_Scalars Maciej Sobczak
  0 siblings, 1 reply; 8+ messages in thread
From: gautier_niouzes @ 2007-02-07 14:15 UTC (permalink / raw)


BTW
- it seems that Normalize_Scalars is in Ada 95, Initialize_Scalars is
GNAT-only.
- combine with -gnatVa and you'll see bugs falling in clouds...
______________________________________________________________
Gautier         -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, e-mail address on the Web site!




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

* Re: Normalize_Scalars
  2007-02-07 14:15   ` Normalize_Scalars gautier_niouzes
@ 2007-02-07 14:43     ` Maciej Sobczak
  2007-02-07 15:36       ` Normalize_Scalars gautier_niouzes
  2007-02-07 15:36       ` Normalize_Scalars Alex R. Mosteo
  0 siblings, 2 replies; 8+ messages in thread
From: Maciej Sobczak @ 2007-02-07 14:43 UTC (permalink / raw)


gautier_niouzes@hotmail.com wrote:
> BTW
> - it seems that Normalize_Scalars is in Ada 95, Initialize_Scalars is
> GNAT-only.

Portable code? :-)

But to be frank, I'm fine with GNAT-only Initialize_Scalars. Thank you 
for pointing me in this direction.

-- 
Maciej Sobczak : http://www.msobczak.com/
Programming    : http://www.msobczak.com/prog/



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

* Re: Normalize_Scalars
  2007-02-07 14:43     ` Normalize_Scalars Maciej Sobczak
@ 2007-02-07 15:36       ` gautier_niouzes
  2007-02-07 15:36       ` Normalize_Scalars Alex R. Mosteo
  1 sibling, 0 replies; 8+ messages in thread
From: gautier_niouzes @ 2007-02-07 15:36 UTC (permalink / raw)


> Portable code? :-)
>
> But to be frank, I'm fine with GNAT-only Initialize_Scalars. Thank you
> for pointing me in this direction.

Anyway, you are not obliged to pollute your code with testing and/or
unportable pragmas. You can put them
in a file like "debug.pra" and compile with -gnatecdebug.pra .
Advantages:
- all your sources will be compiled with the pragma
- you can keep a debug/test version and also have a fast one without
changing source.
- you can use also another Ada compiler for release (or not...).

G.




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

* Re: Normalize_Scalars
  2007-02-07 14:43     ` Normalize_Scalars Maciej Sobczak
  2007-02-07 15:36       ` Normalize_Scalars gautier_niouzes
@ 2007-02-07 15:36       ` Alex R. Mosteo
  2007-02-07 22:12         ` Normalize_Scalars Simon Wright
  1 sibling, 1 reply; 8+ messages in thread
From: Alex R. Mosteo @ 2007-02-07 15:36 UTC (permalink / raw)


Maciej Sobczak wrote:

> gautier_niouzes@hotmail.com wrote:
>> BTW
>> - it seems that Normalize_Scalars is in Ada 95, Initialize_Scalars is
>> GNAT-only.
> 
> Portable code? :-)
> 
> But to be frank, I'm fine with GNAT-only Initialize_Scalars. Thank you
> for pointing me in this direction.

But bear in mind they do opposite things!



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

* Re: Normalize_Scalars
  2007-02-07 15:36       ` Normalize_Scalars Alex R. Mosteo
@ 2007-02-07 22:12         ` Simon Wright
  2007-02-08 10:43           ` Normalize_Scalars Alex R. Mosteo
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Wright @ 2007-02-07 22:12 UTC (permalink / raw)


"Alex R. Mosteo" <devnull@mailinator.com> writes:

> Maciej Sobczak wrote:
>
>> gautier_niouzes@hotmail.com wrote:
>>> BTW
>>> - it seems that Normalize_Scalars is in Ada 95, Initialize_Scalars is
>>> GNAT-only.
>> 
>> Portable code? :-)
>> 
>> But to be frank, I'm fine with GNAT-only Initialize_Scalars. Thank you
>> for pointing me in this direction.
>
> But bear in mind they do opposite things!

?

Normalize_Scalars: "This pragma ensures that an otherwise
uninitialized scalar object is set to a predictable value, but out of
range if possible.' (ARM95)

Intialize_Scalars: "This pragma is similar to Normalize_Scalars
conceptually ..." (GNATRM)



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

* Re: Normalize_Scalars
  2007-02-07 22:12         ` Normalize_Scalars Simon Wright
@ 2007-02-08 10:43           ` Alex R. Mosteo
  0 siblings, 0 replies; 8+ messages in thread
From: Alex R. Mosteo @ 2007-02-08 10:43 UTC (permalink / raw)


Simon Wright wrote:

> "Alex R. Mosteo" <devnull@mailinator.com> writes:
> 
>> Maciej Sobczak wrote:
>>
>>> gautier_niouzes@hotmail.com wrote:
>>>> BTW
>>>> - it seems that Normalize_Scalars is in Ada 95, Initialize_Scalars is
>>>> GNAT-only.
>>> 
>>> Portable code? :-)
>>> 
>>> But to be frank, I'm fine with GNAT-only Initialize_Scalars. Thank you
>>> for pointing me in this direction.
>>
>> But bear in mind they do opposite things!
> 
> ?
> 
> Normalize_Scalars: "This pragma ensures that an otherwise
> uninitialized scalar object is set to a predictable value, but out of
> range if possible.' (ARM95)
> 
> Intialize_Scalars: "This pragma is similar to Normalize_Scalars
> conceptually ..." (GNATRM)

Mmmm I had the following idea about them:

Normalize_Scalars should tries to cause an exception as soon as possible,
because it initializes to an /invalid/ value.

ITOH, Initialize_Scalars will use a /valid/ value for the initialization.

So the former should expose bugs and the latter hide them, for programs that
don't do proper initializations.

But I've seen after your warn that Initialize_Scalars is tailored by the user,
so my remembrances can come from a particular use of this pragma...



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

end of thread, other threads:[~2007-02-08 10:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 13:33 Normalize_Scalars Maciej Sobczak
2007-02-07 13:59 ` Normalize_Scalars gautier_niouzes
2007-02-07 14:15   ` Normalize_Scalars gautier_niouzes
2007-02-07 14:43     ` Normalize_Scalars Maciej Sobczak
2007-02-07 15:36       ` Normalize_Scalars gautier_niouzes
2007-02-07 15:36       ` Normalize_Scalars Alex R. Mosteo
2007-02-07 22:12         ` Normalize_Scalars Simon Wright
2007-02-08 10:43           ` Normalize_Scalars Alex R. Mosteo

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