Functions as parameters and -Os optimization

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

Hi community,

I write a program for AT90CAN128 recently, sending a function as parameter to another function which stores this data into a variable to be used when required.
The program works with optimization -O0 and -O1 but doesn't work with -Os. Does -Os change the semantic of a program so much that functions as parameters are not allowed?

Thanks!

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

> Does -Os change the semantic of a program so much that functions
> as parameters are not allowed?

Nope, it doesn't. Function pointers as parameters to a function are an
element of standard (aka. ISO) C, and as such applicable irrespective
of the optimization level.

Your problem must be elsewhere.

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

Thanks for your reply!

I'll check it.