Author Topic: Does Freepascal has everything "must have" functional features as C does  (Read 4973 times)


  • Hero Member
  • *****
  • Posts: 1060
This is something not achievable with the Pascal case statement. It's just different.

Which is a good thing! Broken code shouldn't compile.
And why do you call it broken? Apart from the unpretty macro definitions, which can reside in a separate include file, the code looks very decent.

As a matter of fact, I'm using it on a daily basis in production code, it is simple, predictable, not clogged by synchronization primitives, etc. The big drawback is that the locals gets lost on each call and if you want to reuse a function, you must pass to it a frame pointer to the locals data (much like self).

But if you have a flat main loop with a few (co-)routines it just works.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000


  • Hero Member
  • *****
  • Posts: 5462
  • Compiler Developer
For the assignment operator (and maybe also other operator overloads returning a custom type) the compiler does take the left side into account, after all it wouldn't be able to pick the correct one otherwise:

Thanks for that. Are you saying that, in effect, they have started taking more notice of the left side type comparatively recently?

That should be the case since forever (aka since assignment operator overloads exist), cause otherwise assignment operators overloads make no sense and are useless.


TinyPortal © 2005-2018