• Jaloopa (unregistered)

    frista

  • Brian (unregistered)

    Ugh, spelling errors in code are one of my major pet-peeves. It shows a lack of attention to detail, which is inevitably an indicator of deeper problems. It's also super annoying that now you have to use that same misspelling anywhere else that function/class/variable is used, unless you can justify a PR that fixes it... which becomes harder as the references multiply throughout the codebase because no one else cares either.

  • (nodebb)

    C++ novice, but couldn't this be a class function of some sort which operates on class variables? Glancing at my code base, I see one (non-static, though) declared as: "void reset();" which seems reasonable to me.

    I do agree that generating an invoice doesn't seem like that sort of function, though.

    Addendum 2026-04-23 09:57: My example operates on an instance of a class and resets it. Not on global variables.

  • Yazeran (unregistered)

    Memberfunctions without any additional arguments are fine as they have the implicit argument of the instance - as your example a instance init() or reset() for instance.

  • (nodebb)

    It could just be a function called on a timer to generate invoices since its last run.

    Without knowing what it is doing it is hard to say if it a WTF or not.

  • Alan Scrivener (unregistered)

    Is the method misspelled?

  • (nodebb)

    The Microsoft documentation states that the static modifier can only be used with member functions, not global functions. But it also states that a static method cannot be used on instances of a class. Therefore it can only access class static variables, global variables and the like. Maybe a WTF, maybe not.

    The name of the function, however, is quite specila.

  • Conradus (unregistered) in reply to Alan Scrivener

    "Commercila" = "Commercial" when the coder's fingers get tangled.

  • FTB (unregistered) in reply to Gearhead

    "static" can totally be used as a linker directive for global functions.

  • MaxiTB (unregistered)

    For starters, in .net static initialization is clearly defined, so static implementations are more viable than for most other frameworks. However you still have the issue that a static approach is not compatible with IoC and toxic for testing.

    However were static Methods like that are super useful is for static feature toggles. You abstract it away with methods, to enable them and then you can make sure, your toggles are initialized no matter from where you check them. So without anything other than this single line it is impossible to guess what this method is.

Leave a comment on “Tune Out the Static”

Log In or post as a guest

Replying to comment #:

« Return to Article