Chris Wolf <cw10...@gmail.com> wrote:
> It depends on your definition of "object".  I hate to nit-pick, but for
> me, "object" may
> contain data or code or both data and code.  So with this definition, C
> implements objects
> without code.

Is there really a fundamental difference between

struct X {
  int data;
  void DoSomething();
};
X x;
x.DoSomething();

and

struct X {
  int data;
};
void X_DoSomething(X* pThis);
X x;
X_DoSomething(&x);

I bet both fragmens would produce nearly identical machine code. In this very 
simple case, even syntactical sugar sprinkled over the first fragment doesn't 
seem to make a huge difference. Of course, once you get into virtual functions 
and multiple inheritance and so on, simulating equivalent behavior in C gets 
progressively more unwieldly (but still possible: in fact, compilers exist that 
take C++ code and produce equivalent C code).
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to