Page 1 of 1
[Implemented] Pointer to functions
Posted: Mon Apr 15, 2002 5:35 am
by BackupUser
Restored from previous forum. Originally posted by Stan.
Hi,
Now that PB includes a way to make forward reference to functions using
declare, it should be quite easy to include pointer to functions as well,
what about it ? ( quicksort is not the only example which may use such a
feature ... ).
I promise I will not ask for function overloading ... ( well not before
next week )
(Implemented with 'Prototype')
TIA.
Bests.
Stan
Since I attended an MS course, my programs no longer have bugs ... just hidden "features" !! [ PB. registered user ]
Posted: Mon Apr 15, 2002 7:15 am
by BackupUser
Restored from previous forum. Originally posted by Rings.
Pointer=@MyProcedure()
Pointer=?Label
Pointer=@Vairable
*StructurePointer
Its a long way to the top if you wanna .....CodeGuru
Posted: Mon Apr 15, 2002 10:31 am
by BackupUser
Restored from previous forum. Originally posted by Stan.
Pointer=@MyProcedure()
Pointer=?Label
Pointer=@Vairable
*StructurePointer
Its a long way to the top if you wanna .....CodeGuru
Thanks !!! I should have tried before asking ...
Stan.
Since I attended an MS course, my programs no longer have bugs ... just hidden "features" !! [ PB. registered user ]
Posted: Wed Apr 17, 2002 12:05 am
by BackupUser
Restored from previous forum. Originally posted by SpaceManoeuvres.
Hello Stan:
I think that function overloading is allready be done
- Added: Variable command argument for any function
See for an example that Danilo has sent here:
viewtopic.php?t=1120
----------------
Christos Karras
Statistics UNIPI
Posted: Wed Apr 17, 2002 5:34 am
by BackupUser
Restored from previous forum. Originally posted by Stan.
Hi SpaceManoeuvres,
Hello Stan:
I think that function overloading is allready be done
...
----------------
Christos Karras
Statistics UNIPI
Maybe overloading is not the appropriate name, I was thinking of something you
can do in C++ :
Code: Select all
// Functions declarations
double function( double d_1, double D_2 ) ;
int function( int i_1, int i_2 ) ;
char function( char c_1, char c_2 ) ;
...
// Use functions
double d_a, d_b, d_c ;
int i_a, i_b, i_c ;
d_c = function( d_a, d_b ) ; // OK ...
i_c = function( i_a, i_b ) ; // OK ...
d_c = function( d_a, i_b ) ; // Compiler error
I do not think this is really difficult to implement in a two pass compiler,
for a single pass one like PB it is certainly a bit more tricky, but it can
be done ( that is say for PB 4.0 ... ).
BTW you tricked me I was not supposed to ask for it before next week !!!
Bests.
Stan
Since I attended an MS course, my programs no longer have bugs ... just hidden "features" !! [ PB. registered user ]
Posted: Wed Apr 17, 2002 10:15 am
by BackupUser
Restored from previous forum. Originally posted by El_Choni.
One thing that is already possible is to get either a float or an integer for a function that was defined to return a float, depending on the type of variable assigned to.
Bye,
El_Choni
Posted: Wed Apr 17, 2002 1:54 pm
by BackupUser
Restored from previous forum. Originally posted by Stan.
Hi,
One thing that is already possible is to get either a float or an integer for a function that was defined to return a float, depending on the type of variable assigned to.
Bye,
El_Choni
That's right but I would like to have for instance sommething like that :
Code: Select all
int print( int a ) ;
int print( float b ) ;
int print( long c ) ;
and be able to use :
Code: Select all
int c = 3 ;
print( c ) ; instead of print( str( c ) )
This may not be the best example, but if I want to it now I have to define
( and remember the name of ) for instance :
float_print( float c ) ;
int_print( int i ) ;
...
I need it because I am a very loosy typist and with years a very bad memory ...
Bests.
Stan.
Since I attended an MS course, my programs no longer have bugs ... just hidden "features" !! [ PB. registered user ]