Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Determining if variable or static string is passed to a Sub
#6
it would require a preprocessor.  to catch every single call to the target subprogram.  then notice if the single argument is a vls variable.  or fixed-length string.  or a literal.

this is because string technically is a pointer.  if the subprogram is called with literal string to pass to it.  the system has to make a copy of that string anyway.  to work with it inside the subprogram.  this will be expected by most people.  if a string variable is passed instead.  it could cause more trouble.  because its value could be changed inside the subprogram.  unless the programmer is willing to force the copying and extra memory spent.  work with the copy instead.  if the value going into the subprogram shouldn't be changed.

in the first post of this thread.  the variablewassent% has to be forced honesty by the programmer as smcneill pointed out.  otherwise it needs observation outside the compiler.

if this is the only subprogram that requires this special treatment.  it would be easy to write a basic program.  actually in any programming language.  that reads in the basic code.  looks only for that call of subprogram.  then make necessary adjustments by adding basic code to the output file.  then use the output file.
Reply


Messages In This Thread
RE: Determining if variable or static string is passed to a Sub - by hsiangch_ong - 05-22-2025, 03:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Variable length type declarations dano 5 683 08-06-2025, 09:53 PM
Last Post: dano
  Most efficient way to build a big variable length string? mdijkens 9 1,875 01-17-2025, 11:36 PM
Last Post: ahenry3068
  Huge array of variable length strings mdijkens 9 1,824 10-17-2024, 02:01 PM
Last Post: mdijkens
  REDIM, TYPE, and STRING Woes TerryRitchie 16 3,131 04-13-2023, 05:17 AM
Last Post: DSMan195276
Lightbulb To mimic "cmd.exe" behavior with eg. "DIRCMD" env. variable mnrvovrfc 4 1,174 09-29-2022, 02:51 AM
Last Post: mnrvovrfc

Forum Jump:


Users browsing this thread: 1 Guest(s)