News for hackers. Stuff that matters.
Re:C++ object model and other internals explained with simpl... by faragon on Tuesday March 29, 2011 @05:46PM (#2384640)
Unfortunately, C++ internals change from compiler to compiler, even from same manufacturer between updates, making impossible usable C++ dynamic libraries safely (C calling conventions are standard, while that is not enough for C++, because of class handling). Unless that becomes solved, C++ will never be able to compete with C for library and system development.
Re:C++ object model and other internals explained with simpl... by eliasmacpherson on Tuesday March 29, 2011 @05:56PM (#2384681)
I will struggle my way through this, having mostly given up on "Inside the C++ Object Model" by Stan Lippman. I have heard it said that Lippman's book is very out of date and a lot of it doesn't apply to modern compilers.

Link seems to be down, although some of it is cached by google. Is there a way to use google webcache to edit the hyperlinks in a cached article so that they point to cached versions of the target?

Re:C++ object model and other internals explained with simpl... by mahmud on Wednesday March 30, 2011 @02:50AM (#2386146)
I thought Lippman's book was adequate. And if you're familiar with the implementation of various statically-typed object models (oxymoron?) then you can see a few ways suggest themselves.

Depends on what you want to do with this knowledge. If you want to use this knowledge for gains in performance, you will have to get your hands dirty and dig into specific implementations.

Re:C++ object model and other internals explained with simpl... by eliasmacpherson on Wednesday March 30, 2011 @02:26PM (#2388486)
I guess I'm complaining more about the reader than the writer. It does provide a useful approach to test specific implementations. It gives good insight as to why certain features are to be avoided for performance, ie multiple inheritance, virtual functions under virtual inheritance, RTTI.

The section on exception handling says that there are compiler dependent code size increases and speed is impacted (5% - 10%) even if it is not triggered. That contradicts Stroustrup in Design and Evolution of C++ where its stated that it should be the same cost as a function call. I've heard other people say that exception handling is now "free". I should spend less time gaining second hand information and more time trying this stuff out myself.

Re:C++ object model and other internals explained with simpl... by malkia on Tuesday March 29, 2011 @06:08PM (#2384714)
In our past games, we had extensive C++ serialization (marshalling, pickling, whatever you call it).

We had to fight gcc 2.95, metrowerks, and few other compilers putting the "virtual table pointer" at different places - begining of object, end, etc. Then alignment differences (not strictly C++), and bitfields. Hopefully mangling was avoided, as we did not had to reference at runtime the data, we had pointers.

It was quite messy, and you could not reuse exported data - had to be for each platform/compiler.

Re:C++ object model and other internals explained with simpl... by cawhitworth on Tuesday March 29, 2011 @05:45PM (#2384638)
Worth noting that this is very gcc specific. Implementation details will vary across compilers, but it's not made clear.
Re:C++ object model and other internals explained with simpl... by phaedrus on Wednesday March 30, 2011 @12:00AM (#2385737)
From the introduction, "NOTE: The actual structure of the generated code depends on the computer architecture, operating system and compiler."
Re:C++ object model and other internals explained with simpl... by swah on Tuesday March 29, 2011 @08:21PM (#2385182)
I'm getting:

  PDOException: SQLSTATE[HY000] [2002] Can't connect to local
  MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
  in lock_may_be_available() (line 165 of 
  /srv/www/avabodh.com/public_html/includes/lock.inc).
Re:C++ object model and other internals explained with simpl... by njs12345 on Tuesday March 29, 2011 @08:27PM (#2385200)
Re:C++ object model and other internals explained with simpl... by reemrevnivek on Tuesday March 29, 2011 @10:34PM (#2385535)
That cache just points to the outline for me. How do I get to, say, the part of the article on exception handling? Or, alternatively, the paper on C?

Disclaimer: I've never used Drupal or a coral cache before, so I don't know how to create these links. I'm going to try the Google cache...

Re:C++ object model and other internals explained with simpl... by njs12345 on Wednesday March 30, 2011 @04:24AM (#2386306)
To make a coral cache link you just append .nyud.net:8090 to the hostname, as above. Less useful nowadays than it once was, back when a good Slashdotting was guaranteed to cause a server meltdown..
Re:C++ object model and other internals explained with simpl... by rdtsc on Wednesday March 30, 2011 @01:31AM (#2385978)
It is also worth highlighting that extensive object oriented systems can and have been built on top of C :

http://library.gnome.org/devel/gobject/stable/

Re:C++ object model and other internals explained with simpl... by jpr on Wednesday March 30, 2011 @02:35AM (#2386114)
If C++ can be explained adequately with simple C code, why use C++ in the first place?
Re:C++ object model and other internals explained with simpl... by mahmud on Wednesday March 30, 2011 @02:46AM (#2386136)
Some manual C code can adequately explain what C++ does automatically.

The difference is cost; you have to link against C code, for some platforms, what C++ provides for free on all platforms.

Re:C++ object model and other internals explained with simpl... by roel_v on Wednesday March 30, 2011 @06:08AM (#2386505)
C++ cannot be explained fully with simple and safe C code. For example, theoretically one could implement the most basic usage of templates with macros; it would however not be easy to work with (error message in the wrong places) and it would still not emulate e.g. template specialization.
Re:C++ object model and other internals explained with simpl... by danssig on Wednesday March 30, 2011 @06:13AM (#2386517)
Better type safety is possible in C++ than in C.