Compiler problem ?!

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compiler problem ?!

1,621 Views
BoSCHoW
Contributor II
Hello,

today while working on ColdFire microchip with Freescale Codewarrior 6.4 I encountered a problem.
Lets say one function is composed of other functions, and when I compile the code it seems like
that this other functions aren't included in the output file.

This functions are used for separating bytes from an short or a long in and to merge 2 bytes into a short and 4 bytes into a long int. The sample code could be seen below:

[code]
UINT16 convert_two_bytes_to_UINT16(UINT8 *bytes)
{    UINT16 result = bytes[0];
    result <<= 8;
    result |= bytes[1];
    return result;
}
[/code]

When I use this function in the main function, in the neverending loop the function works and the return value corresponds to the value of 2 bytes.

I don't know what do to, so if somebody had simmilar problems I cindly ask them for some help.
Thanks and best regards,
BoSCHoW.
Labels (1)
0 Kudos
3 Replies

353 Views
BoSCHoW
Contributor II
Hi,

actually i dont know. If I want to check this where I have to look ?
Anyway what is the solution for this problem, if the compiler made an inline function ?

thanks and
Best Regards,
BoSCHoW.
0 Kudos

353 Views
CompilerGuru
NXP Employee
NXP Employee
Why is it a problem if the compiler did just inline the code?
It appears to be a good candidate for inlining for me.
Anyway, check the project preference panels, I think the default setting for inlining is "smart", which means the compiler can pick the ones he want to inline.

Does the code not behave properly? (Which would mean it is not just an inline issue)

Daniel

0 Kudos

353 Views
CompilerGuru
NXP Employee
NXP Employee
Is the problem that the compiler did inline this function?
Daniel
0 Kudos