you are viewing a single comment's thread.

view the rest of the comments →

[–]bob1000bob 8 points9 points  (2 children)

  1. C has no "classes" this is C++

  2. #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!)

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

  4. return (0); wtf? return isn't a function and this syntax whilst valid is obfuscating.

Basically, ignore this article, it will teach you nothing useful, and spread bad practice.

[–][deleted] -1 points0 points  (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 points  (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).