error compiling wdt_enable in c++

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this line

wdt_enable(WDTO_500ms);

raises an error at compile-time:

Quote:
Fehler 2 1761 : cast from pointer to smaller type 'uint16_t' (aka 'unsigned short') loses information Z:\CAN-Adapter\CANUSB-Adapter\Firmware\CANUSB_AVR50\CANUSB\Main.cpp 956 3 CANUSB_CPP

The code was fine before, but I have a lot of trouble at the moment while using some c++-Code in my project.

Maybe this error comes from the change from c to c++

Happy New Year!!![/code]

I program like a man:
COPY CON: > firmware.hex

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Even if it were right, the "error" should be a warning.
The message generator appears to believe that pointers are larger than 16 bits.
This came up in another thread.
Don't know why wdt_enable would cast from point to integer.
Use -save-temps and show us the .ipp or whatever file is used for preprocessed source code.

"SCSI is NOT magic. There are *fundamental technical
reasons* why it is necessary to sacrifice a young
goat to your SCSI chain now and then." -- John Woods

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

is this from the compiler or the naggy?

naggy does/did think that pointers were longer than 16 bits.

I also wonder whether you have the correct line... I do not see anything that expects a pointer in the code provided.

regards
Greg

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, this is from Naggy - if you see a diagnostic of the form :, it's from Naggy.

Damn, this is becoming embarassing - time for another release I guess :(

Regards

Senthil

 

blog | website

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Seems that the problem comes from naggy, indeed.
The code compiles okay, even the line is marked as error.

I program like a man:
COPY CON: > firmware.hex