tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] question about bit-fields


From: Rick Hodgin
Subject: Re: [Tinycc-devel] question about bit-fields
Date: Sun, 27 May 2012 13:28:30 -0700 (PDT)

Didier,

You're able to take the code and modify that requirement.  It seems 
straight-forward enough that TinyCC is (in memory at compile-time) determining 
the target size, regardless of the storage size, and using that for the storage 
size in memory.  You could alter that code to always use the smallest 
storage-size, and automatically upsize to the larger form, such as something 
stored as 1..7 bits always being stored as a single byte, even if it's scoped 
as an int.

Such a patch would be desirable, and could work with a command-line switch 
(something like --pack-bit-fields).

Best regards,
Rick C. Hodgin

--- On Sun, 5/27/12, Didier Barvaux <address@hidden> wrote:

> From: Didier Barvaux <address@hidden>
> Subject: Re: [Tinycc-devel] question about bit-fields
> To: address@hidden
> Date: Sunday, May 27, 2012, 7:47 AM
> 
> > > Is there an option or a declaration to make tcc
> compute the expected
> > > length for unsigned-int-based bit fields?
> > 
> > No, there isn't.
> > 
> > AFAIK the C standard says this is
> implementation-defined.
> > For portability don't use bitfields.
> 
> Thank for your answer. I see the problem. I added a check
> for this
> compiler's behaviour in my configure script.
> 
> The code of my example is a reduced version of struct iphdr
> defined
> by GNU libc's netinet/ip.h. It means that every programs
> using the
> GNU libc's IPv4 header (or its BSD variant) cannot work fine
> if built
> with tinycc.
> 
> Regards,
> Didier
> 
> -----Inline Attachment Follows-----
> 
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]