|
|
View previous topic :: View next topic |
Author |
Message |
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
[Explained] Prototype mismatching function - no warning? |
Posted: Thu Jan 30, 2020 9:27 am |
|
|
Is there a way to enable a warning when something like this happens?
header file:
Code: | void foo(); // no return value |
source file:
Code: | int16 foo() // returns an in16
{
return 42;
} |
A coworker had a mismatch in his code like this, and was getting a "Contact CCS" error and it wouldn't build. I tried to recreate that on my system, and don't get that error, but also don't get a warning.
When I use GCC, I crank up all the warnings. I'm not sure how to do that (if even possible) inside the CCS IDE. _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002.
Last edited by allenhuffman on Thu Jan 30, 2020 9:35 am; edited 1 time in total |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19619
|
|
Posted: Thu Jan 30, 2020 9:32 am |
|
|
That won't give an error, unless the code tries to use the foo
function before it's declaration. It'll treat the prototype as being for
a different overloaded version of the function. |
|
|
allenhuffman
Joined: 17 Jun 2019 Posts: 602 Location: Des Moines, Iowa, USA
|
|
Posted: Thu Jan 30, 2020 9:33 am |
|
|
Ah, a difference because of the C++ stuff that has moved into C. That makes sense.
Is there any way to turn on "prototypes required" in this compiler? _________________ Allen C. Huffman, Sub-Etha Software (est. 1990) http://www.subethasoftware.com
Embedded C, Arduino, MSP430, ESP8266/32, BASIC Stamp and PIC24 programmer.
http://www.whywouldyouwanttodothat.com ?
Using: 24FJ256GA106, 24EP256GP202 and 24FJ64GA002. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|