🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3876

Re: Quick questions (but no longer so quick)

#3876
From: Andrew Bell
Date: Mon, 01 Apr 1996 04:19
48 lines
2902 bytes
clamage@Eng.Sun.COM (Steve Clamage) wrote:
>C++ implementations don't exist in a vacuum. They
>have to coexist with platform ABIs (Application Binary Interface, the
>bit-level description of data and function calls). It is common for an ABI
>to specify rules for structured types that are different from the rules
>for simple types, no matter what the contents of the structure. 

But where would our example [ class Short { int short; }; ] ever need
to appear as anything other than a short, save within the C++ program
itself?  

>Either the generated code is incompatible with system and 3rd-party
>libraries, or the compiler violates the C++ standard.

Given that name-mangling isn't standard or consistent from compiler to
compiler, unless you have a library created by that same compiler
(that would thus realize the alignment would be as per short), when
would this matter?  The only case I can think of is for SOM or some
other system-level object modelling proposal.

Is what I want to do (add member funcs to an already-defined class),
and have some way to define conversion operators from the old class to
the new such a rare concept?  Seems like I read a lot about the
conflict between adding lots of functions to a class and keeping it
simple and usable, and having support for wrappers would be a possible
way to deal with this.

Say:

wrapper new_class : <public,protected,private> base_class
{
	...
};

Wrappers could not have new member variables, virtual functions of any
kind, or more than one base class.  Conversion from a wrapper to the
base would be automatic.  It would need some way to define conversions
the other way (the new_class member funcs might not apply to all
base_class objs, just some of them).

Andrew Bell
abell@mindspring.com
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Technical Details
Message-ID: <4jnip5$916@mule2.mindspring.com>
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
References: <4jajk2$17aq@mule1.mindspring.com> <4jbto7$78i@engnews1.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!cs.mu.OZ.AU!bounce-back
From: abell@mindspring.com (Andrew Bell)
Newsgroups: comp.std.c++
Subject: Re: Quick questions (but no longer so quick)
Date: 01 Apr 96 04:19:13 GMT
Organization: MindSpring Enterprises
Approved: fjh@cs.mu.oz.au
Message-ID: <4jnip5$916@mule2.mindspring.com>
References: <4jajk2$17aq@mule1.mindspring.com> <4jbto7$78i@engnews1.Eng.Sun.COM>
NNTP-Posting-Host: mundook.cs.mu.oz.au
X-Original-Date: Mon, 01 Apr 1996 03:35:21 GMT
X-Newsreader: Forte Agent .99.82
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMV9ZUuEDnX0m9pzZAQH4LgF/euNNu8ioaEqnl1mvifjNV+TNGtb7PqWD
 EEJeFb//eNBrHnE52qNuMalc0I73+v6/
 =Oh09
Originator: fjh@mundook.cs.mu.OZ.AU