View previous topic :: View next topic |
Author |
Message |
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
#inline |
Posted: Thu Jan 13, 2005 4:21 am |
|
|
I am using PIC16F877A, compiler version 3.190
When I use the "#inline" as follows:
#inline
void TxPacket(BYTE *Descriptor)
{
}
I get the error: Function definition different from previous definition
The function delared as: void TxPacket(BYTE *Descriptor);
Any ideas? _________________ Alex |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
Re: #inline |
Posted: Thu Jan 13, 2005 4:24 am |
|
|
alexz wrote: | I am using PIC16F877A, compiler version 3.190
When I use the "#inline" as follows:
#inline
void TxPacket(BYTE *Descriptor)
{
}
I get the error: Function definition different from previous definition
The function delared as: void TxPacket(BYTE *Descriptor);
Any ideas? |
You need to add #inline to the definition as well.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
Re: #inline |
Posted: Thu Jan 13, 2005 4:26 am |
|
|
Ttelmah wrote: | alexz wrote: | I am using PIC16F877A, compiler version 3.190
When I use the "#inline" as follows:
#inline
void TxPacket(BYTE *Descriptor)
{
}
I get the error: Function definition different from previous definition
The function delared as: void TxPacket(BYTE *Descriptor);
Any ideas? |
You need to add #inline to the definition as well.
Best Wishes |
Which definition?
Where I declare the function you mean? _________________ Alex |
|
![](templates/subSilver/images/spacer.gif) |
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Thu Jan 13, 2005 4:28 am |
|
|
If I add the #inline to the function declaration as well:
#inline
void TxPacket(BYTE *Descriptor);
I get the following error:
Out of ROM, A segment or the program is too large _________________ Alex |
|
![](templates/subSilver/images/spacer.gif) |
alexz
Joined: 17 Sep 2004 Posts: 133 Location: UK
|
|
Posted: Thu Jan 13, 2005 4:48 am |
|
|
Right, I have solved it, I just had too large function.
I have splited it to a few smaller, and no problems then.
The next question is, can I use #inline only for functions, or I can use it for a separete row only as well?
What else does it effect except the speed? _________________ Alex |
|
![](templates/subSilver/images/spacer.gif) |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Thu Jan 13, 2005 6:50 am |
|
|
Quote: | The next question is, can I use #inline only for functions, or I can use it for a separete row only as well?
|
It is for functions. Not sure what you mean by "row" unless you mean line of code which is of course "inline".
Tells the compiler that the function immediately following the directive is to be implemented INLINE. This will cause a duplicate copy of the code to be placed everywhere the function is called. This is useful to save stack space and to increase speed. Without this directive the compiler will decide when it is best to make procedures INLINE. |
|
![](templates/subSilver/images/spacer.gif) |
|