From: Pavel Vozenilek on

"Ulrich Eckhardt" wrote:


> Other than that, using double quotes
> to insert a single character into a stream. ;)
>
Hey, if stdlib is buggy (cough, ... BCB) then one
quickly learns to put double quotes everywhere ;-)

/Pavel



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: tony_in_da_uk on
Standard is for sizeof(type) and sizeof value. E.g. should be
sizeof(std::string), but sizeof my_string.

Any you're right about the long lines & functions - there are a
plethora of these style-abuse issues. What's I'm finding extra
interesting is to read about some these more quirky code-efficiency
things, and stuff that implies a warped conception of the language
behaviour. Liberal sprinkling of friendship is certainly in there, at
least when in the code... :-).

Cheers - Tony


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Carlos Moreno on
tony_in_da_uk(a)yahoo.co.uk wrote:
> Hi all,
>
> Having overhauled thousands of lines of code in the last couple days,
> I'm wondering what other C++ programmer's pet peeves are.

Only one I can think of is the lack of const (and I mean lack of
const *in each and every single isntance* where you're not *required*
not to use it).

Carlos
--

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Jeff Schwab on
tony_in_da_uk(a)yahoo.co.uk wrote:

> Having overhauled thousands of lines of code in the last couple days,
> I'm wondering what other C++ programmer's pet peeves are. I think
> there's some small value in this, as hopefully some of us will see
> things we do and stop, or have someone explain a pet peeve and it won't
> bother us in future.

// Redundant tests.

if( some_bool == true ) // if( some_bool )
if( some_pointer != 0 ) // if( some_pointer )


// Unecessary use of preprocessor.

T* p = NULL; // T* p = 0;
#define SOME_CONSTANT 5 // int const some_constant = 5;


// Inappropriate choice of methods, e.g. list::size()
// is O(n) in some popular implementations.

some_list.size() == 0; // some_list.empty()

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

From: Ulrich Eckhardt on
Stephen wrote:
> What is the "Law of Three" as per your post?

First hit on google:
http://en.wikibooks.org/wiki/Law_of_three
and also mentioned in the FAQ at parashift's.

Uli

--
Questions ?
see C++-FAQ Lite: http://parashift.com/c++-faq-lite/ first !


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Prev: Special container
Next: map within map