Robert Osfield wrote:
Um.... it's probably time you read a few C++ books...

No, actually I've been coding with C++ for about 15 years now, and I like the way I do things better than the way you do. I code the way I do because I find it more readable, more maintainable, and I'm more productive that way. It's not out of ignorance or lack of experience.

I'm sure you have your reasons for the way you do things, and that's fine.


Your coding style is prone to uninitialized variables, scoping issues
with the lifetime of objects, misuse of variables.  Thankfully this
style of coding is very rarely practiced by C++ these days - I don't
recall merging submissions that use this style and I handle lots of
submissions.

Honestly, I almost never have any issues with uninitialized variables these days. I hate the way variables declared inline get scoped. Usually when I design a method, I know what variables I need, and I hate it when a variable isn't available because it got scoped locally to a for loop or something. I also hate it when I'm reading someone else's code, and I can't find where the variable is declared.

There are a lot of things I don't like about C++, which is probably why I use a C-like style. It's too low level to be a high-level object-oriented language, but it's too high-level to be a systems programming language. It's not strongly typed, templates are pure unadulterated evil (this one's going to be controversial :-) ), and the syntax used for the STL makes me prefer to write my own container classes.

And no one can tell me that it's easier to produce nicely formatted output with iostreams than it is with printf :-)

But, I digress... To me there's not really a "correct" way to use C++. There's just the question of coding style.


It might well be a 32/64bit issue.  It's generally pretty easy to
write code that is portable between 32/64bit, the OSG contains very
very little code that is related to 32vs64bit issues.

Generally yes, but I've run into a lot of problems specifically when writing loaders (especially a loader for a format that was designed only for Windows), which is why I think that's the problem here.

To give you an idea, I've seen the Source SDK use "long" inside the same struct that is saved to the file. I'm sure know that long is a different size depending on the architecture, unless you're using Windows. I've also see #pragma pack 1 (force a 1-bit alignment) in one of the headers. That's what I have to deal with, and I probably didn't do a good enough job on the first try :-)


  Unitialized variables is actually a far more common problem in code I see 
which is
why I raised the flag.

Fair enough.

--"J"

_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to