String type function/procedure parameters

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

String type function/procedure parameters

#1 Post by Dany » 07 Dec 2010 13:43

Hi, I noticed (from examples in the help text) that it is no longer necessary to provide the length of strings passed to procedures or functions, so

Code: Select all

procedure procname(var S: string);
is perfectly legal .
Using this construction the warning "source size does not match destination size" when calling a procedure/function can be prevented. It was anyway rather senseless (in my opinion) to provide the max-length information, it was not used further, the strings are always handled as pointers. Great enhancement!

But: I wished I had known this sooner, I could not find anything referring to this parameter possibility in the help explicitely.

Keep up the good work! :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: String type function/procedure parameters

#2 Post by janni » 07 Dec 2010 21:07

Dany wrote:Using this construction the warning "source size does not match destination size" when calling a procedure/function can be prevented.
Not completly :( . Try calling from such a routine another one that has string size specified. Then the warning may look like

1016 Warning: Source size (-1) does not match destination size (10)

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: String type function/procedure parameters

#3 Post by Dany » 08 Dec 2010 14:42

janni wrote:
Dany wrote:Using this construction the warning "source size does not match destination size" when calling a procedure/function can be prevented.
Not completly :( . Try calling from such a routine another one that has string size specified. Then the warning may look like

1016 Warning: Source size (-1) does not match destination size (10)
Of course. Thanks. :D :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”