From: BrianG <me@null.email>
Subject: Re: Passing C-style flags to C subprograms
Date: Mon, 02 Apr 2012 21:44:56 -0400
Date: 2012-04-02T21:44:56-04:00 [thread overview]
Message-ID: <jldkmq$sot$1@dont-email.me> (raw)
In-Reply-To: <jl537p$tv8$1@munin.nbi.dk>
On 03/30/2012 03:57 PM, Randy Brukardt wrote:
> "Natasha Kerensikova"<lithiumcat@gmail.com> wrote in message
> news:slrnjnbu7o.1lme.lithiumcat@sigil.instinctive.eu...
> ...
>
> We considered this and used it for a few sets of flags in Claw, but didn't
> do this in general for a number of reasons:
>
> (1) We needed the flag sets to be extensible without reprogramming. That is,
> if Microsoft adds a new flag value, we want people to be able to use it even
> before Claw is modified to add the flag. That works well with a numeric
> solution (just add a new constant); it doesn't work at all with a bit
> solution (unused bits stay unused).
> (2) Not all of the flag sets are pure bit-maps. Some include combinations so
> that one bit doesn't necessarily represent one flag.
> (3) Ada doesn't have defaults for aggregates; every component has to be
> mentioned (or an others clause used). That means that the aggregates
> representing flags are wordy; and the use of an others clause makes them
> less safe against modification than typical Ada code. (It's about the same
> safety as the original bit-flags; it's not a detrement to using records, but
> it means that there is no advantage in this way, either.)
>
You could also add
(4) Some users may be used to using the "Option_A + Option_B" type
format. While I consider this trivial, in building a library or
binding, you need to worry about your users' priorities, not your own.
It can also make porting existing apps easier. (Of course, you could
always define your own "+" or whatever - and I have done this.)
--
---
BrianG
000
@[Gee, Mail!]
.com
next prev parent reply other threads:[~2012-04-03 1:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-30 18:18 Passing C-style flags to C subprograms Natasha Kerensikova
2012-03-30 19:57 ` Randy Brukardt
2012-04-02 10:40 ` Natasha Kerensikova
2012-04-03 2:14 ` Randy Brukardt
2012-04-03 1:44 ` BrianG [this message]
2012-03-30 21:55 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox