comp.lang.ada
 help / color / mirror / Atom feed
From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: Choice of variant record discriminant (design question)
Date: Mon, 31 Oct 2005 16:53:48 +0100
Date: 2005-10-31T16:53:48+01:00	[thread overview]
Message-ID: <m2pspl8yyb.fsf@hugin.crs4.it> (raw)
In-Reply-To: fP2dnZ4nFtAFQMLenZ2dnUVZ_smdnZ2d@megapath.net

Randy Brukardt wrote:

> I have to wonder if the variant is worth it. There is not going to
> be any space savings,

Right.  But I hardly ever use variant records to save space.

> and in typical use, there isn't going to be much increase in safety,
> either.

Not that much, no.  But I prefer to let the code match the logic of
the problem.

> So I'd probably give up on the variant in this case, because I'd
> rather keep the aggregates (they are big help when a component needs
> to be added). But only you can weight that trade-off, because the
> relative value of the two options is something that depends on the
> components and the intended uses. (If the "empty" variant wasn't
> going to be empty in future version, for instance, the variant would
> make more sense.)

In this case, the null variant is most unlikely to end up containing
data later, so I can not use the argument that I may save space later
using this design.

If I didn't use that Ada allows me to encode the logic of my problem
in the source, couldn't I just as well use C or Fortran?

Thanks for the advice,

Jacob
-- 
"Only Hogwarts students really need spellcheckers"
                                -- An anonymous RISKS reader



      reply	other threads:[~2005-10-31 15:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-26 12:21 Choice of variant record discriminant (design question) Jacob Sparre Andersen
2005-10-26 13:14 ` christoph.grein
2005-10-26 13:26   ` Jacob Sparre Andersen
2005-10-26 17:52 ` Jeffrey R. Carter
2005-10-26 19:52 ` Randy Brukardt
2005-10-31 15:53   ` Jacob Sparre Andersen [this message]
replies disabled

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