Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions cannot return TYPEs or UNIONs??
#1
Is this something new or have I never noticed before... and the better question is why?
Reply
#2
No BASIC i know allows that and in C/C++ each compiler does its way, there's no standard.

After all, the compiler will have to pass a hidden pointer to the function being called and return that pointer (okay, it's not that simple, with small UDT's they are actually returned in registers), there's no black magic.

Currently in 0.13 only prototypes are allowed the return UDT's (mainly to support GSL, i don't know any other library that does that), that may change in future..
Reply
#3
Visual Basic does. :-(

Strike 1 for FB (don't worry, it has too many runs for one to hurt :-))


C'est La Vie
Reply
#4
Yes, VB 6 allows it; it pushes an extra parameter onto the stack, which is a pointer to the returned struct.
Reply
#5
I got what I was after using pointers to the defined TYPE.

Using pointers in BASIC makes me feel.... well, dirty. Its just not natural. :evil:
Reply
#6
Oh VB.. how could i forget that one..

It's simple to M$, they don't have to follow any standards, they create their owns.. i've to follow the GCC 3.x ABI, that is a bitch with UDT's, they can be returned in byte's, word's, dword's, quadwords and even float-point registers, if it were just like VB, returning always a pointer that is implicitly dereferenced, i would add that in 5 minutes, but i can't create my own standards..
Reply
#7
you should be the One creating the standards man ;D
Reply
#8
I second that sentiment, if all other compilers are providing for this is some odd way, then we would be conforming to the norm by doing it our own way.
his sig left intentionally blank
Reply
#9
Following C standards means you are able to link C libraries without a problem. If you do your own standard you are isolated.
Antoni
Reply
#10
What about returning several parameters (like wxBasic), will this be possible in the future?
(not as structure...)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)