Re: Object-oriented programming in standard ANSI C
- From: "E. Robert Tisdale" <edwin@xxxxxxxxxxx>
- Date: Fri, 17 Nov 2006 16:37:35 -0800
Roland Pibinger wrote:
Your approach is similar to the results of my experiments with OO in
C. You can increase encapsulation when you only forward declare your
structs (e.g. struct Shape) in the header files.
Unfortunately, your approach precludes automatic function inlining.
Also some functions (e.g. actualShape_draw) can be removed form the header
and made 'private', i.e. static, in the respecive *.c file.
This would preclude any explicit call to function actualShape_draw.
An optimizing C++ compiler will elide the virtual {messenger} function
and call the actual function directly
if it can determine the actual type at compile time.
----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.
- Follow-Ups:
- Re: Object-oriented programming in standard ANSI C
- From: Roland Pibinger
- Re: Object-oriented programming in standard ANSI C
- From: CBFalconer
- Re: Object-oriented programming in standard ANSI C
- References:
- Object-oriented programming in standard ANSI C
- From: Thierry Chappuis
- Re: Object-oriented programming in standard ANSI C
- From: E. Robert Tisdale
- Re: Object-oriented programming in standard ANSI C
- From: Roland Pibinger
- Object-oriented programming in standard ANSI C
- Prev by Date: Re: func() in implementation and func (100, 200, 300) in calling
- Next by Date: Re: fscanf issues, please help.
- Previous by thread: Re: Object-oriented programming in standard ANSI C
- Next by thread: Re: Object-oriented programming in standard ANSI C
- Index(es):
Relevant Pages
|