Jump to content
Sign in to follow this  
danutz

Bit Access On A Struct Member

Recommended Posts

SourceBoost IDE 6.60

BoostC

Target: any 16F

 

I get the following compile error when I try to access individual bits of a struct member:

 

failure

D:\Prj\ec\program\test2\test_struct_bit.c(13:6): error: unexpected '.' operator after 'b'

D:\Prj\ec\program\test2\test_struct_bit.c(13:2): error: failed to generate expression

D:\Prj\ec\program\test2\test_struct_bit.c(13:2): error: invalid operand 'st.b.4'

D:\Prj\ec\program\test2\test_struct_bit.c(13:9): error: failed to generate expression

Failed to locate output file 'test_struct_bit.obj'

Done

 

Failed

 

The program that will reproduce the error is:

 

#include <system.h>

 

struct str

{

unsigned char a, b;

};

 

struct str st;

 

void main()

{

st.a = 2;

st.b.4 = 1;

}

 

 

Dan

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...