Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-01-2001, 10:06 PM
Genesis Genesis is offline
Junior Member
 
Join Date: Jan 2001
Posts: 13
Default Delphi to C++.. The "with" reserved word. What is it in C++?

Nobody on the C++ forum knows what I mean when I try to explain:

/*

with DXDraw1.Surface.Canvas do begin
pen.mode := pmNotXor;
MoveTo(x,y);
LineTo(x,y);
LineTo(x,y);
LineTo(x,y);
...
release;
end;

// is better than

DXDraw1.Surface.Canvas.pen.mode := pmNotXor;
DXDraw1.Surface.Canvas.MoveTo(x,y);
DXDraw1.Surface.Canvas.LineTo(x,y);
DXDraw1.Surface.Canvas.LineTo(x,y);
DXDraw1.Surface.Canvas.LineTo(x,y);
...
DXDraw1.Surface.Canvas.release;

*/

They don't know what I mean. Maybe this means there ISN'T one for C++? Oh well, just love the with statement so much, don't want to live without it!

Anyone know if there is a "with" statement in C++, and if so, what is it?

Thanx
Reply With Quote
  #2  
Old 03-02-2001, 04:30 AM
MrBaseball34 MrBaseball34 is offline
Senior Member
 
Join Date: Jan 2001
Posts: 7,260
Default RE: Delphi to C++.. The "with" reserved word. What is it in C++?

No, there is no with in C++. You will have to prefix
each call with the object type.
Reply With Quote
  #3  
Old 03-07-2001, 04:46 AM
Paul_Farr Paul_Farr is offline
Junior Member
 
Join Date: Mar 2001
Posts: 2
Default RE: RE: Delphi to C++.. The "with" reserved word. What is it in C++?

It is possible to use a C macro to create this. I had a
need for this last year, no longer have the code.

Sorry!

BTW: I have seen similar threads on this elsewhere, some
C++ compilers accept :

struct {
int x,y;
} MyStruct;

MyStruct *MyObject;

MyObject->X=1
->Y=2;

/* note myobject is omitted, and previous semi is
also
*/


I guess the short summary is: C is more verbose, and
literal. There is often a general consensus to stay
away from void* (pointers) in C, while in Delphi it is
a mainstay. Once you code Delphi, C will always seem to
take longer!

Just my 2 cents.....
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:46 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.