473,385 Members | 1,292 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,385 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 1807
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.