|
-
August 19th, 2005, 01:41 PM
#31
Re: C++ pet-peeves
The source code is portable. However, the data-layout of the STL containers may not be portable. This is a concern if you distribute a library that uses STL containers as part of the interface.
For example, if I write a library using MSVC 8.0 that exposes a function "void Foo(const std::string& str);", but someone uses Digital Mars's compiler to interface with it, then the user's application will pass a reference to Digital Mar's implementation of std::string rather than the expected MSVC 8.0 std::string. Any differences of internal layout will lead to undefined behavior.
Yeah guess your right. Never really thought about it that way as every library I have used has come with full source which you build yourself. I did say if you made no assumptions about the containers inner workings but if the library is already compiled then those assumptions have already been made.
Hungarian notation is the bane of self documenting code.
Forget all fancy tricks with operator precedence. Code should be easily readable.
May the BOOST be with you.
Good free E-Books thanks to Bruce Eckel.
-
August 19th, 2005, 04:15 PM
#32
Re: C++ pet-peeves
My company's policy is to hide the internals (we're quite protective about the internal engineering IP) and consequently have to think about these things. We've been bitten most often by structure alignment issues because most of our API is C. But if we go to C++, the STL containers will be another thing we'll have to think of.
Kevin Hall
-
August 20th, 2005, 10:57 AM
#33
Re: C++ pet-peeves
Favorite pet peeve? Most programmers are lousy at what they do, even after many years of experience. Fix that problem and the rest go away (as if you ever could).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|