compiler icon indicating copy to clipboard operation
compiler copied to clipboard

FIX: Set actual default values in usage()

Open Kwarde666 opened this issue 3 years ago • 1 comments

What this PR does / why we need it: Changes default values in usage() to default values instead of current values. NOTE: I simply ran pawncc without arguments (and making sure no alias was set), used given values from there. Looking at initglobals() this could still not be 100% accurate:

  #if AMX_COMPACTMARGIN > 2
    sc_compress=TRUE;    /* compress output bytecodes */
  #else
    sc_compress=FALSE;
  #endif

AMX_COMPACTMARGIN hould be 64 by default, no idea what that does any futher (not that much into AMX). Seems like it should be fine though.

Which issue(s) this PR fixes: None opened

What kind of pull this is:

  • [x ] A Bug Fix
  • [ ] A New Feature
  • [ ] Some repository meta (documentation, etc)
  • [ ] Other

Additional Documentation: N/A

Kwarde666 avatar Jul 08 '22 23:07 Kwarde666

Firstly, you should've created an issue to report the problem in the first place (which, if I understand it correctly, is that command line arguments overwrite default values before the compiler prints them in function usage(), e.g. if we invoke the compiler as pawncc -O0 it will print default: -O0 for option -O, while it's supposed to print -O1).

Secondly, hardcoding those values at the place of their use is a bad practice. If we'll need to change them for one reason or another, we'll have to modify them not only in function resetglobals(), but also in usage(). A good solution should involve keeping those values in one place, e.g.:

// somewhere at the top of sc1.c
#define sDEFAULT_DEBUG_LEVEL sCHKBOUNDS

// in initglobals():
sc_debug=sDEFAULT_DEBUG_LEVEL;

// in about():
pc_printf(" -d<num> debugging level (default=-d%d)\n", sDEFAULT_DEBUG_LEVEL);

Daniel-Cortez avatar Jul 30 '22 15:07 Daniel-Cortez