Re: Pointer to "base" type - what does the Standard say about this?
- From: Antoninus Twink <nospam@xxxxxxxxxxxxxx>
- Date: Wed, 5 Nov 2008 16:25:17 +0000 (UTC)
On 5 Nov 2008 at 15:34, Stephan Beal wrote:
Am i headed down a Dark Path with this approach? Or is there a better/
more acceptable approach to simulating single inheritance in C? (i'm
not abject to changing the model, but i really do need some form of
separate interface/implementation for what i'm doing.)
Having subtype as "base class struct + some extra fields" and casting
back to the base when necessary is completely ubiquitous in networking
code based on Berkeley sockets. So if your code is meant to run on
Windows or a *nix that does networking, then this approach will
certainly work.
If your interested in head-on-a-pin discussions about whether it will
work on embedded C for a coffee machine with half the standard library
missing, the "regulars" will no doubt be along soon with their usual
grandstanding answers.
.
- Follow-Ups:
- Re: Pointer to "base" type - what does the Standard say about this?
- From: Jean-Marc Bourguet
- Re: Pointer to "base" type - what does the Standard say about this?
- From: Stephan Beal
- Re: Pointer to "base" type - what does the Standard say about this?
- References:
- Pointer to "base" type - what does the Standard say about this?
- From: Stephan Beal
- Pointer to "base" type - what does the Standard say about this?
- Prev by Date: Re: lcc-win (was: The lcc-win string library)
- Next by Date: [OT] Very slow file mapping?
- Previous by thread: Pointer to "base" type - what does the Standard say about this?
- Next by thread: Re: Pointer to "base" type - what does the Standard say about this?
- Index(es):