Does C++ allow default return types for functions?

In C the following horror is valid:

myFunc()
{
  return 42;  // return type defaults to int.
}

But, what about in C++? I can't find a reference to it either way...

My compiler (Codegear C++Builder 2007) currently accepts it without warning, but I've had comments that this is an error in C++.

Answers


It's ill-formed in C++. Meaning that it doesn't compile with a standard conforming compiler. Paragraph 7.1.5/4 in Annex C of the Standard explains the change "Banning implicit int".


Need Your Help

How do I use require.js on the serverside?

javascript node.js backbone.js

I use it on the client right now with Backbone.js, but I'd like to use it with node.js also.

JAVA - Should I set null to every instaciated object after using it?

java performance garbage-collection

I have a doubt about Java Garbage Collector. Just to illustrate, I have a json like this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.