r/programming • • Sep 26 '09

Ask Proggit: What are the most elegantly coded C/C++ open source projects?

I've recently been reading (parts of) the source for sqlite3 and found it to be a revelation in good programming practise.

What other C/C++ open source projects (of any size) would you recommend that I look at, in order to get an idea of current good practise?

144 Upvotes

292 comments sorted by

View all comments

Show parent comment

2

u/[deleted] Sep 27 '09

Hungarian notation is in no way related to how descriptive your variable names should be. I use both, and it works well, and it ain't hard to read at all.

VTable* pVTable;

there you go.

int iVTableCount = 5;
float fRatio = 0.5f;

if find this way more descriptive than

int vtablecount = 5
float ratio = 0.5f;

yeah it may look all fine right there, but scroll down some more in a function and try to remember which type is which variable can be a pain and doesn't help catching type errors quickly. The whole point of the Hungarian notation is to avoid stupid programming errors that really shouldn't happen.

Sure, you can rely of the compiler's warnings, or Visual Assist, or Intellisense... but relying too much on your environment is never a good idea. Code should be clear in the first place, even when edited in notepad.

1

u/astrosmash Sep 27 '09

Hungarian notation is in no way related to how descriptive your variable names should be

Except that in practice it is, which was the point of my post and of the example I presented.

That is precisely the problem with Hungarian Notation, not that it allows descriptive names but that in practice it's a crutch used for avoiding descriptive names.