Results 1 to 2 of 2

Thread: Is it required to implement all possible variable types?

  1. #1

    Is it required to implement all possible variable types?

    There are some cases where it would be extremely beneficial to my code to write a very specific USERCOMMAND to take a number of specific variables together. But it quickly becomes prohibitive to write out every permutation of types if there is more than one parameter.

    Some of the posts here indicate that you do need to, and the tutorial implies it. Is there any way around this?

    A specific use I would have for it is handling several bit flags to a USERCOMMAND to compare them. It would be much more readable if I could write a USERCOMMAND to take in several bytes instead of doing bitmasking, multiple comparisons, or some other variation.

    There are plenty of other uses I could think of for taking in several specific parameters.

    Thank you,
    Matt

  2. #2
    Senior Member
    Join Date
    Sep 2011
    Location
    australia
    Posts
    253
    Quote Originally Posted by matthewmenze View Post
    There are some cases where it would be extremely beneficial to my code to write a very specific USERCOMMAND to take a number of specific variables together. But it quickly becomes prohibitive to write out every permutation of types if there is more than one parameter.
    it's not essential to cover every permutation and combination for your input vars, just provide macros for what you intend to use. if you try to compile code that uses a combination you omitted it will generate a compiler error indicating the missing macro shell.

    take look at my tft addin , I have only generated macros for the very limited range of input combinations that I expected to be useful , its no great drama to add more macros for missing combo's when and if necessary.
    http://www.picbasic.co.uk/forum/showthread.php?t=20115

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •