473,791 Members | 2,853 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Big Deal with returning int

Min
I have seen so many pointing out "main" should explicitly return "int".
Beside, the language spec or committee, or some guru said so, what is a BIG
deal with it ? What difference does it make if "void main" rather than "int
main" ? It is not that some obscure code that people can't understand
easily. Anyway, would someone explain why ;? not just it is better to
return explicitly.

Or How is it possibly cause the problem ?

PS: I am saying this because most of C++ books I found, uses "void main".
If they can't get this fundamental thing right, I guess, I have been reading
all the garbage from them.
Jul 19 '05 #1
2 1879
"Dill Hole" <di******@micro soft.com> wrote in message
news:sd******** *************** *********@4ax.c om...
On Sun, 29 Jun 2003 13:59:15 +0200, Rolf Magnus <ra******@t-online.de>
wrote:
I see it a bit different. If an author uses void main, that shows that
he doesn't know C++ very well. This gives not much trust in the rest of
the book.
It's quite interesting that you call "void main" common practise, since
it actually never was allowed. So you think the rule should be changed,
because nobody follows it anyway?


Misspelling "practice" shows that you do not know English very well.
If you do not have English mastered why should we trust your C++
abilities?


Why exactly a command of English is necessary in order to be a competent C++
programmer escapes me. Anyway, if you're going to resort to pedantry in an
attempt to prove something, you might as well get it right. Consider your
final sentence: "If you do not have English mastered why should we trust
your C++ abilities?" Now you may consider this overly pedantic, but I'm
curious to know whether you have encountered commas in your clearly
extensive study of the English language. Of course, in "Dill Hole" English,
a peculiar dialect apparently spoken only by you, it's quite possible that,
in the final sentence above, the word "mastered" is not followed by a comma.
Unfortunately, this is not the case in the actual language. I think what I'm
saying essentially boils down to the well-known proverb, "People in
glasshouses shouldn't throw stones."

While we're engaging in the rather pointless activity of launching
"ad-hominem" attacks, might I also suggest that a course in logic would
benefit you enormously? A command of English is neither necessary nor
sufficient for a programmer. There are many extremely good programmers who
don't speak a word of English. There are also many people who speak
excellent English but would find a C++ program incomprehensibl e. Whilst it
is important to be able to write correctly in your native language, for
reasons largely unrelated to programming, your ability (or otherwise) to do
so is nevertheless irrelevant to your ability as a C++ programmer.

Now that that's settled, can we try and avoid "ad-hominem" attacks that add
nothing to the discussion at hand?

Cheers,

Stuart.
Jul 19 '05 #2

Andre Kostur wrote:
[...]
POSIX.1 is a platform/implementation specific library,
http://msdn.microsoft.com/archive/de...msdn_posix.asp

<quote>

POSIX stands for Portable Operating System Interface for computing
environments. POSIX began as an effort by the IEEE community to
promote the portability of applications across UNIX(R) environments
by developing a clear, consistent, and unambiguous set of standards.
However, POSIX is not limited to the UNIX environment. It can also
be implemented on non-UNIX operating systems, as was done with the
IEEE Standard 1003.1-1990 (POSIX.1) Implementation on Virtual
Memory System (VMS), Multiprogrammin g Executive (MPE), and the
Conversion Technology Operating System (CTOS). POSIX actually
consists of a set of standards ....

</quote>
and thus is off-topic for this newsgroup.


Nothing is off-topic here, darling.

regards,
alexander.
Jul 19 '05 #3

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

Similar topics

9
11917
by: mjm | last post by:
Folks, Stroustrup indicates that returning by value can be faster than returning by reference but gives no details as to the size of the returned object up to which this holds. My question is up to which size m would you expect vector<double> returns_by_value() {
8
2090
by: Derek | last post by:
Some authors advocate returning const objects: const Point operator+(const Point&, const Point&); ^^^^^ Returning a const object prevents some bad code from compiling: Point a, b, c; (a + b) = c; // error
10
10298
by: Fraser Ross | last post by:
I need to know the syntax for writing a reference of an array. I haven't seen it done often. I have a class with a member array and I want a member function to return an reference to it. Returning a pointer to the first element might do but I want to do what I've said. Fraser.
7
2318
by: wonderboy | last post by:
Hey guys, I have a simple question. Suppose we have the following functions:- //-----My code starts here char* f1(char* s) { char* temp="Hi"; return temp;
17
3265
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ================================================================================ /* A function that returns a pointer-of-arrays to the calling function. */ #include <stdio.h> int *pfunc(void);
48
3382
by: Frederick Gotham | last post by:
The "toupper" function takes an int as an argument. That's not too irrational given that a character literal is of type "int" in C. (Although why it isn't of type "char" escapes me... ) The "toupper" function imposes a further constrait in that the value passed to it must be representable as a unsigned char. (If C does not require all character values to be positive, then again, this constrait too escapes me... ) Let's say we have the...
6
1909
by: EvilOldGit | last post by:
const Thing &operator++(int) { Thing temp = *this; operator++(); return temp; } Is this code robust ? I get a compiler warning about returning a reference to a a local, which I guess is because the compiler doesn't tell the difference between this overload any any other function.
89
5774
by: Tubular Technician | last post by:
Hello, World! Reading this group for some time I came to the conclusion that people here are split into several fractions regarding size_t, including, but not limited to, * size_t is the right thing to use for every var that holds the number of or size in bytes of things. * size_t should only be used when dealing with library functions.
23
2945
by: pauldepstein | last post by:
Below is posted from a link for Stanford students in computer science. QUOTE BEGINS HERE Because of the risk of misuse, some experts recommend never returning a reference from a function or method. QUOTE ENDS HERE I have never heard anyone else say that it is a problem for a function
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.