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?
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?
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.