I would certainly like to see the ability to pass arguments to functions in PBP. The typical method for doing that uses the stack but PICs are somewhat limited in that regard. There are other ways to pass arguments and it would be most helpful if this was implemented.
I also posted a message just prior to this about string types and functions. The omission of those and not being able to pass parameters are not overwhelming problems. The real problem is that anyone with experience using any other BASIC or C compiler will, as I did, just come to a screeching halt when needing a string or trying to create a function. Instead of being able to think about the action or problem you are trying to implement or resolve, you are suddenly trying to figure out how to implement alternatives to almost universal features that are missing. Basic is supposed to make things easy. Adding these features would go a long way toward doing that.
Functions with arguments
Re: Functions with arguments
So would a lot of others http://www.picbasic.co.uk/forum/showthread.php?t=12107MikeRoElectronika wrote:I would certainly like to see the ability to pass arguments to functions in PBP.
Functions
Function is declared like this:
sub function function_name(parameter_list) as return_type
[ local declarations ]
function body
end subfunction_name represents a function’s name and can be any valid identifier. return_type is a type of return value and can be any simple type. Within parentheses, parameter_list is a formal parameter list similar to variable declaration. In mikroBasic PRO for PIC, parameters are always passed to a function by value. To pass an argument by address, add the keyword byref ahead of identifier.
Local declarations are optional declarations of variables and/or constants, local for the given function. Function body is a sequence of statements to be executed upon calling the function.
Why pay for overpriced toys when you can have
professional grade tools for FREE!!!
professional grade tools for FREE!!!