Jump to content
Sign in to follow this  
FrankGe

Problem With Bit Variables In Struct

Recommended Posts

Hello,

 

Sourceboost: 5.8

Boostc: 1.91

OS: XP sp2

 

A little project

 

#include <system.h>

 

struct Test

{

char c;

bit b;

};

 

void get(struct Test *t)

{

t->c = 1;

t->b = 0;

}

 

void main()

{

struct Test t;

 

t.b = 1;

t.c = 5;

 

get(&t);

}

 

The compiler gives an error

 

Compiling...

 

"C:\Program Files\SourceBoost\boostc.pic16.exe" -t PIC16F877A test2.c

 

BoostC Optimizing C Compiler Version 1.9.1 Beta (test build) (for PIC16 architecture)

http://www.picant.com/c2c/c.html

Copyright© 2004-2005 Pavel Baranov

Copyright© 2004-2005 David Hobday

 

 

test2.c(12:7): internal error: failed to generate assignment expression

failure

Done

 

Frank

Share this post


Link to post
Share on other sites

Structures can't have bit members. There are too many complications with this especially when struct pointers are used. In the future compiler releases compiler will throw an error when it finds bit struct/union member.

 

Regards,

Pavel

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...