Re: [dev] Object-Oriented C for interface safety?

From: Greg Reagle <greg.reagle_AT_umbc.edu>
Date: Wed, 26 Nov 2014 20:45:34 -0500

If you want to program in C, there are ways to implement abstract data
types, encapsulation, and implementation hiding that are fairly easy.
Basically this involves using the "static" keyword for functions and
variables that you want to be private to the implementation and don't
put their prototypes/declaration in the .h file you intend for public
use. Then you can declare the variables and functions that you want to
be public without the "static" keyword and put their prototypes in the
public .h file. You can craft the module at whatever level of
abstraction/data hiding that you want.

Here is one example
http://alastairs-place.net/blog/2013/06/03/encapsulation-in-c/

If you want a higher level language than C (I don't blame you if you
do), some people on this list have recently mentioned Go and Rust.

-- 
http://www.fastmail.com - IMAP accessible web-mail
Received on Thu Nov 27 2014 - 02:45:34 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 27 2014 - 02:48:08 CET