values. You must check for unexpected values before you start to use
them. Any code that does not do so will not pass Phonologies Coding
Standards and hence will be returned back to you in no time and with no
mercy. Be a good neighbor.
"Sir, Arrays and Pointers are same": Dream on.
=== gcc Warnings ===
Here we will discuss about gcc compile-time warnings. Here is the real-
life run of "app_voiceXML.c" that we use with [[http:"
www.asterisk.org/|
Asterisk]].
my-Test.c: In function wait_for_answer:
my-Test.c:962: warning: implicit declaration of function
senddialevent
my-Test.c:966: warning: implicit declaration of function get_cid_name
my-Test.c:966: warning: passing argument 3 of ast_set_callerid makes
pointer from integer without a cast
my-Test.c:1133: warning: implicit declaration of function
onedigit_goto
my-Test.c: In function VoiceXML_exec:
my-Test.c:1261: warning: assignment discards qualifiers from pointer
target type
my-Test.c:1272: warning: assignment discards qualifiers from pointer
target type
my-Test.c:1284: warning: assignment discards qualifiers from pointer
target type
my-Test.c:1295: warning: assignment discards qualifiers from pointer
target type
my-Test.c:1306: warning: assignment discards qualifiers from pointer
target type
my-Test.c:1320: warning: assignment discards qualifiers from pointer
target type
my-Test.c:1354: warning: unused variable end
my-Test.c:1354: warning: unused variable content
my-Test.c:1534: warning: unused variable dummy
my-Test.c:1653: warning: too many arguments for format
my-Test.c:1847: warning: passing argument 3 of ast_call makes integer
from pointer without a cast
my-Test.c:1879: warning: implicit declaration of function
send_ipx_transfer_result
my-Test.c:1932: warning: implicit declaration of function sprint
my-Test.c:1852: warning: unused variable peerflag
my-Test.c:1774: warning: unused variable who
my-Test.c:1773: warning: unused variable f
my-Test.c:1252: warning: unused variable cat
my-Test.c: At top level:
my-Test.c:2101: warning: return type defaults to int
my-Test.c:2101: warning: no previous prototype for
send_ipx_transfer_result
my-Test.c: In function recv_ack_initial_sdp:
my-Test.c:736: warning: control reaches end of non-void function
my-Test.c: In function send_ipx_transfer_result:
my-Test.c:2117: warning: control reaches end of non-void function
my-Test.c: At top level:
my-Test.c:419: warning: print_proto_packet defined but not used
my-Test.c:517: warning: recv_ack_prepare defined but not used
my-Test.c:764: warning: send_ipx_prepare defined but not used
You will never ever discard the gcc warning. Warnings like:
* "passing argument 3 of ast_call makes integer from pointer without a
cast" almost always results in run-time [[http:"en.wikipedia.org/wiki/
Logic_error | semantic error]] that can take days and even months to
solve.
* "control reaches end of non-void function " will result in problems
like return value of a function was going to be passed to some other
function or to be assigned to some variable but function did not return
anything which will again cause run-time semantic error.
* "send_ipx_prepare defined but not used" . You can ignore it but you
will not. The point is, if there are too many unused variables then some
important warning, for which very few words appear on the screen, can be
lost between the mess of these unused variables. So you have to remove
all the unused variables before you pass this file to the teammate. BTW,
if you are not using a variable whats the point of defining it ? ..
Don't give me the crap that it can be used in future. In future if it