force compiler error/warning

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

Hi all,

the attached file implements a simple way to set the AVR Baudrate registers. The method is: Use floating point calculations and let compiler/optimiser remove all of the floatingpoint code. The method iself is applicable for other applications, too. It is also being used in .

The question I have: In lines 107-111 an error condition is checked and an error/warning is supposed to be issued, but only if the error condition is really met.
So far, I didn't find any solution for this (tried divide by zero, ...). Any ideas?

Thanks,
Hans-Juergen

Attachment(s): 

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

You can only cause an error in the preprocessor, but then
you need to perform all calculations in the preprocessor to
get the decision there. This means no floatingpoint support
is available, as the CPP can only perform integer arithmetics.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Quote:
You can only cause an error in the preprocessor, but then
you need to perform all calculations in the preprocessor to
get the decision there. This means no floatingpoint support
is available, as the CPP can only perform integer arithmetics.

This is what i feared,

Thanks,
Hans-Juergen