Jump to content
Sign in to follow this  
FrankVD

Boostc++ Assignment Operator Bug

Recommended Posts

Hello,

 

I found another bug using version 6.97 of BoostC++ while porting part of the microchip TCPIP stack to get MRF24WB0M wifi module to work:

 

(target is PIC18F97J60)

 

#define MY_DEFAULT_IP_ADDR_BYTE1		(unsigned long) (10)
#define MY_DEFAULT_IP_ADDR_BYTE2		(unsigned long) (10)
#define MY_DEFAULT_IP_ADDR_BYTE3		(unsigned long) (1)
#define MY_DEFAULT_IP_ADDR_BYTE4		(unsigned long) (23)

#define IP_ADDR	unsigned long

typedef struct  
{
IP_ADDR		MyIPAddr;			   // IP address

} APP_CONFIG;


APP_CONFIG	MyAPP;


main()
{
 MyAPP.MyIPAddr |= MY_DEFAULT_IP_ADDR_BYTE1;
 MyAPP.MyIPAddr |= MY_DEFAULT_IP_ADDR_BYTE2<<8;
 MyAPP.MyIPAddr |= MY_DEFAULT_IP_ADDR_BYTE3<<16;
 MyAPP.MyIPAddr |= MY_DEFAULT_IP_ADDR_BYTE4<<24;
 // result MyAPP.MyIPAddr= 0x17010A0A (works)

 MyAPP.MyIPAddr = MY_DEFAULT_IP_ADDR_BYTE1 | MY_DEFAULT_IP_ADDR_BYTE2<<8 | MY_DEFAULT_IP_ADDR_BYTE3<<16 | MY_DEFAULT_IP_ADDR_BYTE4<<24;
 // result MyAPP.MyIPAddr= 0x17000A0A   (does not work, should have the same outcome as above, the 3th byte(MY_DEFAULT_IP_ADDR_BYTE3) is always 0 )

// I tried using the latest version 7.03 and the result with that is:
// result MyAPP.MyIPAddr= 0x0000000A   ( only the first byte is correct, the rest is 0)

}

 

Regars Frank.

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