What are * .r files in C?

Possible duplicate:
what is a "private header" in c

I am addressing this question:

Can you write object oriented code in C?

The accepted answer to this question posted a link to the book: http://www.cs.rit.edu/~ats/books/ooc.pdf

In this book, the author uses * .r files, except for * .c and * .h files. * .r files are used as headers, hiding the implementation of "C-classes" from users

My question is what are * .r files?

are they standard for coding in C?

Or is this what Axel Schreiner came up with when writing his book?

+3
source share
2 answers

I quickly looked through the PDF file, and here is an example of what you mean:

struct Class new.r new.h:


struct Class {
  size_t size;
  void * (* ctor) (void * self, va_list * app);
  void * (* dtor) (void * self);
  void (* draw) (const void * self);
};

.r (, .r) , :

void * new (const void * class, ...);
void delete (void * item);
void draw (const void * self);

, , c :

void draw (const void * self)
{ 
  const struct Class * const * cp = self;
  assert(self && * cp && (* cp) —> draw);
  (* cp) —> draw(self);
}

, .r , , , , r .r - "".

+3

* r * , , .r. .p .q. , .

+3

All Articles