C backend/declaring functions.

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

C backend/declaring functions.

Post by jassing »

Any chance of this ever being doable?

Code: Select all

! int blah(int i) { return( i*2 ); }
Procedure hmm()
  ! return( blah(3) ); // << unresolved
EndProcedure
Debug hmm() 
breeze4me
Enthusiast
Enthusiast
Posts: 633
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: C backend/declaring functions.

Post by breeze4me »

Something like this.

Code: Select all

DataSection
  ! int blah(int i) { return( i*2 ); }
EndDataSection

Procedure hmm()
  ! return( blah(3) ); // << unresolved
EndProcedure

Debug hmm()
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: C backend/declaring functions.

Post by jassing »

breeze4me wrote: Fri May 24, 2024 4:53 pm Something like this.
PERFECT!

That would never have occurred to me! Slick!!!

Thank you!
jassing
Addict
Addict
Posts: 1885
Joined: Wed Feb 17, 2010 12:00 am

Re: C backend/declaring functions.

Post by jassing »

Not so perfect. A good idea, better than what I had been doing (repeating code).

It can break the program/module "Barrier" & using a label can cause problems with compile time. (easy enough to get around it by adding "data.b 0" after the label.

still, better than where I was this morning!
User avatar
idle
Always Here
Always Here
Posts: 5840
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: C backend/declaring functions.

Post by idle »

That's a sneaky solution. :mrgreen:
Post Reply