Forum > FPC development

What happened to the built in CARD() function?

(1/5) > >>

meteoricshipyards:
Way back in the late 70's and early 80's I worked with Pascal on a CDC NOS machine.  This past Summer I recently found a listing of an Adventure game that I played way back then.  I researched, found Lazarus and Free Pascal, and started typing it in.  One thing that didn't work was the CARD() function.  For those of you who don't know it, it returns the number of items in a set variable.  (For really obscure trivia, it was implemented as a single instruction on the CDC 60 bit architecture). 

As I only had one type of set that I needed the function for, I coded up my own.  But I was wondering when and why it disappeared, and if I should be aware of other items that may have gone away.

Tom A.
Planning on "publishing" the game on an Interactive Fiction site in within a month.

molly:

--- Quote from: meteoricshipyards on January 12, 2016, 11:29:59 pm ---One thing that didn't work was the CARD() function.

--- End quote ---
Perhaps you might find this thread interesting.

marcov:
It never was in Turbo Pascal, so if it was standard, it already fell off before.

It is also possible it was just some intrinsic for a CDC instruction and not standard.  As Molly correctly pointed out, FPC has popcount, but it is only for integers, so only works for sets the size of a register.

Thaddy:
@Marco: You yourself suggested PopCnt sometime ago.... ;)
http://stackoverflow.com/questions/12934017/knowing-how-many-elements-a-set-have

If that is correct and there are already compiler iintrinsics, it shouldn't be too hard to massage the compiler into having a card().

marcov:
My point is mainly that if an ancient compiler had it, it is not necessarily standard.

But I guess nothing stops you from submitting a patch if it is easy.

Navigation

[0] Message Index

[#] Next page

Go to full version