4 ms·
Pascal equivalent of C union is a variable record. Nowadays in Delphi (Free Pascal still doesn't have that) records can be used as classes, with their own membe
by unnouinceput 4y ago
Pascal equivalent of C union is a variable record. Nowadays in Delphi (Free Pascal still doesn't have that) records can be used as classes, with their own members and just like classes, their functionality can be expanded using some sort of inheritance mechanism called "helper". Actually, in Delphi, the only difference between a class object and a record object is that classes allow dynamic allocation while records are instantiated on stack from beginning all the way to the end of the program.
You should try Delphi nowadays, it has plenty of modern languages concepts implemented. Not to mention the compiler speed and the cross platform capability for all OS'es that matter.
- speed_spread 4y agoI just looked it up. The lowest-priced package is $1,599. A "Free Demo" doesn't interest me. I assume Embarcadero has some really good customers who are very satisfied with what they deliver. But they're not exactly cultivating a new user base with those terms.
- jll29 4y agoMinor terminology correction: "variant record", actually: https://www.freepascal.org/docs-html/ref/refsu15.html https://www.freepascal.org/docs-html/ref/refsu15.html And yes, Delphi has a small but loyal following. But personally, I feel more comfortable relying to standardized languages (preferred: ISO) and among those a pick with easily recruitable talent. So I wouldn't recommend a new production development in Delphi myself.
- FpUser 4y ago"Records as classes" are different from "variant records". And they do exists in either Delphi and FreePascal. In FreePascal those are called "advanced records". You can get better help on those here: https://wiki.freepascal.org/Record https://wiki.freepascal.org/Record .