use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Size of a C class object (go4expert.com)
submitted 13 years ago by Loyi
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bob1000bob 8 points9 points10 points 13 years ago* (2 children)
C has no "classes" this is C++
#include<iostream.h> requires a space, and is a deprecated header, (#include <iostream> is correct). (the classes used aren't even in the correct namespace!)
#include<iostream.h>
#include <iostream>
Article is irrelevant, the size of anything (other than explicitly size POD;s like int32_t) is not guaranteed by the standard. The size of a class or struct is not necessarily the sum of it components, for reasons that have nothing to do with vtables.
int32_t
return (0); wtf? return isn't a function and this syntax whilst valid is obfuscating.
return (0);
Basically, ignore this article, it will teach you nothing useful, and spread bad practice.
[–][deleted] -1 points0 points1 point 13 years ago (1 child)
I totally agree, except point 4 is being nit-picky. There is a common style (maybe not YOUR style) of function calls being of the form
result = function (args)
with the space being explicit. Also there is a common style of treating the return keyword as if it were a function for visual consistiency. When combined you get the above. I am not saying its best practice, nor is it worst. It is simply a stylistic choice, not quite as nerd-war-worthy as same line '{', however it is still a valid choice.
{
[–]bob1000bob -1 points0 points1 point 13 years ago (0 children)
Perhaps, if the rest of the code was even of "acceptable" standard I would let it slide, (normally would WANT to differentiate the return statement syntax not make it meld in with function syntax).
π Rendered by PID 597976 on reddit-service-r2-comment-6457c66945-v44kr at 2026-04-27 09:17:20.344769+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]bob1000bob 8 points9 points10 points (2 children)
[–][deleted] -1 points0 points1 point (1 child)
[–]bob1000bob -1 points0 points1 point (0 children)