PDA

View Full Version : Tip with C translation



{MSX}
24-01-2005, 03:08 PM
hi, i've found this:


if(b>max) max=b,index=1;
if(c>max) max=c,index=2;


is this translation right:

if(b>max) then begin max:=b;index:=1; end;
if(c>max) then begin max:=c;index:=2; end;


How comes the assignement are separated by "," instead of ";" ?

thanks

savage
24-01-2005, 05:25 PM
I think that would be an accurate translation, but I would tidy up the code and not have it all on one line :).

C has way too many short-cut coding styles which sometimes make the code hard to follow.

WILL
25-01-2005, 01:02 AM
Right on the money dude. ;)

Oh I have to add this; Types, types, types! They make a world of difference ESPECIALLY if you are working with extern calls from DLL files.

An Int in C is NOT an Integer in Pascal. And I think the same with a Float and a Real...not 100% on that one though.

Lightning
25-01-2005, 07:05 PM
Well if you look at .NET specs you can see Borland ideeas are being used by MS, strong, clear types, system unit.
Unfortunately there are many people wich dont even know Object Pascal exists and wonder what this Delphi thingy is.
Object Pascal rulez, wake up people.