Skip to content

Instantly share code, notes, and snippets.

@tcoyvwac
Created May 17, 2024 12:24
Show Gist options
  • Save tcoyvwac/2c3ba945fdd45e7cbe54d43627315426 to your computer and use it in GitHub Desktop.
Save tcoyvwac/2c3ba945fdd45e7cbe54d43627315426 to your computer and use it in GitHub Desktop.
reshade: Summarise code-section of ReshadeUniform::{PingPongUniform,RandomUniform}() #1289

Some questions arose when making this changeset:


  • A static free-function was needed to be made for this code-condense.
    However, where should one place any static free-function in source code?

    • ...at the top / beginning of the source code file?
    • ...or "in-place" - so declared "just" before its needed usage (by the functions which need to call and use it)?

    (Default answer: "In-place")


  • C++ standard conventions would recommend using an anonymous / unnamed namespace over static (free-)functions instead.

    However...

    • Should one introduce an anonymous namespace to a translation unit's (TU) source code, if one's TU does not use them already? - (Default answer - No)
    • Does this project "prefer and recommend" using only static free-functions over the preferred C++ standard of using anonymous namespaces? - (Default answer: Yes - for now)

  • A new (helper) "datatype" was needed for this changeset. For argument-dependent lookup (ADL) reasons, the datatype had to be declared on the "top-level" namespace. (This is the global namespace as this TU does not use any uniquely-local user-defined namespaces).

    • Should one make helper datatypes, even if it may have to be declared on a top-level namespace? - (Default answer: Yes)

    • Should one prefer to make any helper datatypes...

      • ...based on currently available and already defined datatypes, but aliased. (a.k.a: weaktyped datatype) or
      • ...a uniquely-created struct / class datatype - (a.k.a: strongtyped datatype)...
        • ...even if there is datatype with the same purpose already available in the project?

      (Default answer: Prefer weaktyped datatypes).


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment