Non-standard C features?

Non-standard C features?

Post by John Vaudi » Sat, 05 Jul 2003 02:13:11


Sorry for this newbie question.

From the lcc-win32 user manual.

--8<--

The framework provided by lcc-win32 centers about providing a simple
interface for calling all the functions associated with a certain control.
The general syntax for using this objects is:

object->Method(arguments)

This is a short hand for the normmaly used C syntax, that has ben
simplified. In strict C you woould be required to write:

object->lpVtbl->Method(object,arguments);

--8<---

I'm puzzled about this. Does this mean that lcc supports some kind of C++
style method calling, or this is achieved with macros or some such? What is
'the framework' to which it refers? Where shoudl I be looking to read about
this stuff?

Thanks

John Vaudin
mailto: XXXX@XXXXX.COM
 
 
 

Non-standard C features?

Post by John » Sat, 05 Jul 2003 03:39:10


I can't find any of that in the lcc-win32 docs.

is
about

An example that might help using these methods is on my web site in the
libraries section. It's called 'StringObject'.

John

 
 
 

Non-standard C features?

Post by Robert Wis » Sat, 05 Jul 2003 10:01:22


It is under the Table of Contents listing "The Framework"

Robert Wishlaw
 
 
 

Non-standard C features?

Post by John Vaudi » Sun, 06 Jul 2003 07:20:30


of
is
:

I understand function pointers, and I understand how C++ implements virtual
functions using vtbls.

I have a very specific question though.

In your example you use

obj->vtbl->method(args)

No problem - I understand this.

BUT the documentation says


Which implies to me that I can rewrite

obj->vtbl->method(args) as obj->method(args)

Either the documentation is wrong and this is not true, or LCC implements
some kind of language extention to allow this syntax.

I really just want to know which it is. I am begining to suspect that the
documentation is misleading, but I'd be grateful if someone could explain.

Thanks

John
 
 
 

Non-standard C features?

Post by John » Sun, 06 Jul 2003 14:57:53


Or even obj.method()


Yes, it's an extension.

As I wrote before.
===============
An example that might help using these methods is on my web site in the
libraries section. It's called 'StringObject'.
===============

http://www.yqcomputer.com/ ~john.findlay1/
http://www.yqcomputer.com/

John
 
 
 

Non-standard C features?

Post by John Vaudi » Tue, 08 Jul 2003 18:01:57


implements

I have looked at the example. It answers some of my questions but not all.

In C++ the compiler knows to do this because you have a reference to an
object of some class with a virtual function defined on it. How does LCC
know to apply this magic? Is the name pVtbl magic in some way? I'd still
like to see some kind of documentation.

I have looked through the section on 'Special Features of lcc-win32' and I
can see no mention of this extension. I'm sure, given a spare moment, I
could knock up some test cases and deduce the bahviour, but I don't really
think that should be necessary.

John
 
 
 

Non-standard C features?

Post by John » Tue, 08 Jul 2003 19:22:55


<snip>

Can't help with the documentation but yes, it's a special feature added by
Jacob.

When used in the fashion shown by my example the object is implicit and
passed as the first parameter.

Depending on if the object is a pointer to struct you would do

obj->Func(something);

If the object is a struct you would do

obj.Func(something);

I don't know what else to say - :)

John
 
 
 

Non-standard C features?

Post by John » Wed, 09 Jul 2003 17:22:56


control.

Thanks Robert, only just found it in lcc.chm !!

Perhaps it should be called

lcc-win32_user_manual.chm

John