473,394 Members | 1,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Why in some compilers if a function is not declared, the compilergives out a "warning" and not an "error"??

In ARMCC, and Microsoft C, when i use a function which is never
defined or delared, it gives out a warning, not a compiling error?
why?

(This leads to a bug to my program since I seldom pay much attention
to warnings...)

Thanks for explanation!
Dec 9 '07 #1
4 1808
In article <0b**********************************@s12g2000prg. googlegroups.com>,
lostlander <lo************@gmail.comwrote:
>In ARMCC, and Microsoft C, when i use a function which is never
defined or delared, it gives out a warning, not a compiling error?
why?
It might not matter, if it never gets called (which may of course
depend on the input). I suppose it's a convenience to programmers
building a system incrementally.
>(This leads to a bug to my program since I seldom pay much attention
to warnings...)
The flaw here doesn't seem to be in the compiler!

-- Richard
--
:wq
Dec 9 '07 #2
lostlander wrote:
In ARMCC, and Microsoft C, when i use a function which is never
defined or delared, it gives out a warning, not a compiling error?
why?
Under "C90" rules, and under "K&R" rules even before them,
using an undeclared function is/was legal. The compiler assumes
that the unknown function takes an unknown number of arguments of
unknown types and returns an int value. If you write `f(42)' with
no declaration of `f', the compiler acts as it would if you had
previously written `int f();' as a declaration.

Under "C99" rules it is an error to use an undeclared function.
However, the Standard doesn't really distinguish between "errors"
and "warnings" (except in the case of the #error directive), so
the only real change is from "diagnostic optional" to "diagnostic
required."
(This leads to a bug to my program since I seldom pay much attention
to warnings...)
Trying for a Darwin Award, are you?

--
Eric Sosman
es*****@ieee-dot-org.invalid
Dec 9 '07 #3
On Sun, 9 Dec 2007 03:05:57 -0800 (PST), lostlander
<lo************@gmail.comwrote in comp.lang.c:
In ARMCC, and Microsoft C, when i use a function which is never
defined or delared, it gives out a warning, not a compiling error?
why?

(This leads to a bug to my program since I seldom pay much attention
to warnings...)
Please tell us your company's name so we can make a point of never
buying anything they make.

It you had worked for me, you wouldn't anymore.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Dec 9 '07 #4
lostlander wrote:
In ARMCC, and Microsoft C, when i use a function which is never
defined or delared, it gives out a warning, not a compiling error?
why?

(This leads to a bug to my program since I seldom pay much attention
to warnings...)
C90 permits calls to undeclared functions. The linking process,
however, usually generates an error if there are undefined references.
Some linkers have an option to generate an executable file even through
there are undefined references (called function doesn't exist). Are you
getting an undefined reference error from your linker (translation phase 8)?

--
Thad
Dec 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jerry | last post by:
Hi people: I'm experiencing the following problem and don't know what it is about. Any help greatly appreciated: My script retrieves the data from a remote file using the file() function....
4
by: Danny | last post by:
Hi I don't understand why I keep getting "Error: Object expected" I tried different things and haven't been able to solve it. I'm a newbie so I'm not sure what I'm doing wrong. The debugger breaks...
3
by: Generic Usenet Account | last post by:
This is a two-part question. (1) I have implemented a "Datastructure Registry" template class. I am getting no compiler warnings with older compilers, but newer compilers are generating the...
8
by: Chul Min Kim | last post by:
Hi, I got a BUS ERROR from one of my company's program. Let me briefly tell our environment. Machine : Sun E3500 (Ultra Sparc II 400Mhz CPU 4EA) OS : Solaris7 Compiler : Sun Workshop...
1
by: Andreas Poller | last post by:
Hello, I have the following problem: I have a class deriving from ICustomTypeDescriptor: public __gc class TPropertyBag : public ICustomTypeDescriptor { private: ...
1
by: ken.carlino | last post by:
Hi, I have the following compile error instantiated from here, I appreciate if someone can help me find out why? g++ -O0 -g3 -Wall -c -fmessage-length=0 -ostddev.o ../stddev.cpp...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
5
by: Torben Laursen | last post by:
I am writing a COM in C# using visual studio 2005 and VSTO. Inside the code I use some support classes that are generic but they are not used in the inferface of the COM. However I still get a...
3
luke14free
by: luke14free | last post by:
Do you know why do I get that message when i type a normal setcookie function?? Warning: Cannot modify header information - headers already sent by (output started at...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.