![]() |
|
#1
|
|||
|
|||
|
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
|
|
#2
|
|||
|
|||
|
No, there is no with in C++. You will have to prefix
each call with the object type. |
|
#3
|
|||
|
|||
|
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..... |
![]() |
| Thread Tools | |
| Display Modes | |
|
|