Other HI-TECH Compilers & Products >> Other HI-TECH Compilers & Products

Pages: 1
NicolasReboul
stranger


Reged: Oct 18 2007
Posts: 1
Error (741) : bitfield too large
      #30175 - Thu Oct 18 2007 10:53 AM

Hello

I use HI-TECH C COMPILER (Holtek MCU) V9.10PL6 to compile a firmware.

I have a problem with the compilation of this kind of structure (copy from the manual (HI-TECH C for HOLTEK MCU p35))
Code:

struct {
unsigned lo : 1;
unsigned dummy : 14;
unsigned hi : 1;
} foo;




Error(741) W:\xxx...xxx.h 164: bitfield too large (14 bits)
Error(741) W:\xxx...xxx.h 164: bitfield too large (14 bits)
Error(741) W:\xxx...xxx.h 164: bitfield too large (14 bits)


if I change the struct to
Code:

struct {
unsigned lo : 1;
unsigned dummy : 8;
unsigned hi : 1;
} foo;



the compilation is completed successfully

Do you have a solution to solve the problem with a 14 bits field

regards


Post Extras: Print Post   Remind Me!   Notify Moderator  
jtemplesModerator
Guru
****

Reged: Oct 16 2003
Posts: 1339
Loc: Southern California
Re: Error (741) : bitfield too large [Re: NicolasReboul]
      #30188 - Thu Oct 18 2007 07:54 PM

I haven't used the Holtek compiler, but compilers for 8-bit targets don't appear to be required to permit an individual bit-field to be more than 8 bits.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Mark Pappin

***

Reged: Nov 01 2004
Posts: 599
Loc: Brisbane, Australia
Re: Error (741) : bitfield too large [Re: jtemples]
      #30214 - Fri Oct 19 2007 04:33 PM

Quote:

compilers for 8-bit targets don't appear to be required to permit an individual bit-field to be more than 8 bits.


From reading through the Standard just now I think it does require that bit-fields up to at least the width of int be supported.
Regardless, our compilers for 8-bit targets don't allow individual bit-fields wider than 8 bits.
Maybe in a future version they will - the PRO compilers have some internal features that suggest this will be fairly easy to implement across the range.

--------------------
Mark Pappin - HI-TECH Software


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:  ndouglas, jtemples, Dan Henry, Andrew L, mikerj, dave g, meisty, josh stevo 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 1990

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5