Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

readexe version 0.1 (Announce)

posted by segin Homepage E-mail, Springfield, MO, USA, 11.08.2023, 12:46

> Hello segin,
>
> Welcome!
>
> > bitfields by OR/XOR/ANDing together preprocessor macros onto a single
> > integer value holding all the flags is NOT allowed; C99 is the rule and
> > bitfields are how we do. Any code using preprocessor macros with hex
> values
> > to be OR/XOR/ANDed to a raw integer shall be rejected for this reason.
> Use
> > C99 bitfields if you want to contribute.
>
> Well, I like me some bit-fields myself, when I can use them. The fact
> though is that they are famously unportable, and therefore less than
> useful when dealing with binary formats over a network. N1570 (the final
> draft of the C11 standard) says under 6.7.2.1,
>
> > The order of allocation of bit-fields within a unit (high-order to
> low-order or low-order to high-order) is implementation-defined. The
> alignment of the addressable storage unit is unspecified.

The byte order of multi-byte integers is implementation-defined. Any brief review of the code would find that there's no checking of host byte order, and even a code comment stating a hard assumption on little-endianness.

>
> I would say that it is best to keep that in mind.

In practice, every x86 C99 compiler I've encountered does exactly what you'd expect.

If it doesn't work for someone, they can file a ticket if and when we cross that bridge. If OpenWatcom and gcc never change how they handle C99 bitfields, then this is a bridge we may never cross - I don't expect end users to compile source code on whatever random compiler they happen to not have (because regular end-users don't keep C compilers installed for the off-chance they find random C source to compile). I expect end users to consume prebuilt binaries. As long as the builds I make work, that'll be good enough for basically everyone interested.

If it breaks on AIX (for example), I don't care. I don't have an AIX machine to test on, and I'm not going to start pedantically writing as perfectly as possible portable C with the ISO standards open at all times next to me because of this. Doing just that is likely to still result in buggy code that I don't know anything is wrong with because of just how much of the C language - standard library included - is "implementation-defined" - no matter how perfectly I adhere to ISO 9899:1999. It'll lead to overly verbose code doing a lot of oft-unnecessary (for most users - x86 users) runtime checks (or worse, overly verbose code with more logic in preprocessor macros than in actual compiled code), increasing code size. How well does your ia16 GNU toolchain fork handle medium code model again?

So I'm just not going to worry about it until I have an actual practical reason to worry about it, in an application of the KISS principle.

>
> Thank you!

 

Complete thread:

Back to the forum
Board view  Mix view
22632 Postings in 2109 Threads, 402 registered users, 388 users online (1 registered, 387 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum