| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: Pascal - C |
So to andrew clarke do I speak these words:
Thursday April 11 1996 01:29, andrew clarke wrote to steven pasztor:
>> What's the closest one can get in C++, to Borland Pascal's
>> enum/sets?
ac> enum day {sun, mon, tue, wed, thu, fri, sat};
ac> is equivalent to
ac> day = (sun, mon, tue, wed, thu, fri, sat)
ac> in Pascal, as far as I can recall.
Yar... I think that's right... It's really sets that I was inquiering
about... In Pascal you could create an enum, and then turn it into a set.
"DayVariable + [sun]" could be likened to "DayVariable |
sun" in C (I think...) only the size of DayVariable could be up to 32
bytes, and was determined automatically from the number of items in the
set. Admittedly it may not work too well when you go assigning strange
values to the items in the enum, but oh well...
>> And is it possible to do something like Pascal's nested procedures?
ac> I presume you mean something like:
ac> procedure wrapper;
ac> procedure inside;
ac> begin
ac> writeln('Hello from the inside.');
ac> end;
ac> begin
ac> writeln('Hello world.');
ac> end;
ac> C doesn't support silly stuff like this. I'm not sure if it's
ac> standard Pascal either. (?)
It's not silly. Quite useful actually... And your not wasting an extra
segment to access the parent procedures vars, since they're in the same
segment as yours, just at an offset from some register other than BP...
Leaves you free to use DS and ES as you please, and it also cuts down on
the amount of stuff that needs to be passed when calling a recursive
procedure which is only called from one procedure. If you manage
understand what I'm saying...
nevets
... Diagonally parked in a parallel universe.
--- FMail/386 1.0g
* Origin: HELP!!! (3:632/103.123)SEEN-BY: 50/99 78/0 620/243 623/630 632/103 348 360 998 633/371 634/384 388 SEEN-BY: 634/396 635/301 502 503 544 639/252 711/401 409 410 413 430 808 809 SEEN-BY: 711/932 934 712/515 713/888 714/906 800/1 7877/2809 @PATH: 632/103 348 635/503 50/99 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.