Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



C# User defined function added in library but no error

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 12-02-2009
Member
 
Join Date: Jan 2009
Posts: 18
C# User defined function added in library but no error
  

Hi,
I am learning C++ & I have added a function to the standard library math.lib in my turbo C++ compiler.
I have not declared the prototype for this function & neither i have used any header file too. This must get me an error message but it do not give me any error. I dont understand why is this happening?

Anyone could answer this to me?

Reply With Quote
  #2  
Old 12-02-2009
Member
 
Join Date: Jan 2009
Posts: 44
Re: C# User defined function added in library but no error

I don't think you are not getting any error with this thing!
You must be getting an error IF you call this new function at the compile time & if you are not calling then it wont give you any error message thats a simple thing! What are you using int or Void?
Reply With Quote
  #3  
Old 12-02-2009
Member
 
Join Date: May 2008
Posts: 2,286
Re: C# User defined function added in library but no error

1. If you call an undeclared function then the C Standard mandates that the function return value is assumed to be int and the arguments are handled as in the pre-ANSI, pre-prototype, days of K&R C where the argument type is inferred from the value/variable that is passed in the function call. This is not a formal error condition so it is not surprising that you don't get a compiler error. It is disappointing that you don't get a compiler warning.

2. What is the prototype of your function? If it doesn't match the inferred K&R prototype then you can expect bugs. However, there need not be a dramatically announced run-time error -- you will just get the wrong answer.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "C# User defined function added in library but no error"
Thread Thread Starter Forum Replies Last Post
What are user defined exceptions in Java? Migueel Software Development 5 30-11-2009 06:27 PM
How to create user-defined service on Windows XP killerboy Operating Systems 2 31-07-2009 11:37 PM
end user defined characters Gunter Windows Software 4 13-07-2009 09:36 AM
Create user defined functions in Excel 2007 AbhayD Windows Software 3 24-06-2009 07:05 PM
When to create User Defined Data Type in VB.Net Nihar Khan Software Development 3 27-02-2009 10:29 AM


All times are GMT +5.5. The time now is 09:12 AM.