Browse Prior Art Database

Technique for Increased Encapsulation in C

IP.com Disclosure Number: IPCOM000120249D
Original Publication Date: 1991-Apr-01
Included in the Prior Art Database: 2005-Apr-02
Document File: 2 page(s) / 47K

Publishing Venue

IBM

Related People

Busboom, CD: AUTHOR [+3]

Abstract

A method to improve data encapsulation in the C programming language is disclosed. The method enhances the C macro preprocessor to achieve the desired results.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 100% of the total text.

Technique for Increased Encapsulation in C

      A method to improve data encapsulation in the C
programming language is disclosed.  The method enhances the C macro
preprocessor to achieve the desired results.

      Fig. 1 is an example of a defined constant, a macro, and how
they are expanded.  This example works quite well, but does not make
use of data encapsulation.

      Data encapsulation can be enhanced by extending the
preprocessor language with a new statement of the form '#predefine
arg-list'.  This new statement would be identical to a normal macro
definition except it will be expanded before any other #define
statement.  Other than this new statement, the order of expansion
will remain the same.  The new preprocessor will first expand any
predefines in the current statement, then any macros, and finally any
arguments of the macros.  Fig. 2 is an example which shows this new
form.  The code that is generated by this example is identical to the
code expansion of the first example.