• 0 Posts
  • 30 Comments
Joined 2 months ago
cake
Cake day: March 22nd, 2025

help-circle


  • skisnow@lemmy.catoLemmy Shitpost@lemmy.worldSpeak American
    link
    fedilink
    English
    arrow-up
    12
    arrow-down
    1
    ·
    2 days ago

    I wish there were some internationally recognized symbols to represent languages as distinct entities from their countries of origin, but the idea of trying to make some seems really unpopular for some reason.

    There’s other languages that have far more politically contentious flags representing them - at least all the English-speaking countries are broadly allies. Spare a thought for the Taiwanese who have to select a People’s Republic of China flag, even though the language is as much theirs as it is the PRC’s, or the large number of Russian-speaking native Ukrainians who have to select the flag of the country who’s bombing them and their families.

    The notion of a country owning a language is fraught with toxicity (indeed, Russia’s claim to vast swathes of Ukraine leans heavily on it), and if languages had their own flags we could sidestep the whole issue.













  • The code is a set of preprocessor macros to stuff loads of booleans into one int (or similar), in this case named ‘myFlags’. The preprocessor is a simple (some argue too simple) step at the start of compilation that modifies the source code on its way to the real compiler by substituting #defines, prepending #include’d files, etc.

    If myFlags is equal to, e.g. 67, that’s 01000011, meaning that BV00, BV01, and BV07 are all TRUE and the others are FALSE.

    The first part is just for convenience and readability. BV00 represents the 0th bit, BV01 is the first etc. (1 << 3) means 00000001, bit shifted left three times so it becomes 00001000 (aka 8).

    The middle chunk defines macros to make bit operations more human-readable.

    SET_BIT(myFlags, MY_FIRST_BOOLEAN) gets turned into ((myFlags) |= ((1 << 0))) , which could be simplified as myFlags = myFlags | 00000001 . (Ignore the flood of parentheses, they’re there for safety due to the loaded shotgun nature of the preprocessor.)


  • Back in the day when it mattered, we did it like

    #define BV00		(1 <<  0)
    #define BV01		(1 <<  1)
    #define BV02		(1 <<  2)
    #define BV03		(1 <<  3)
    ...etc
    
    #define IS_SET(flag, bit)	((flag) & (bit))
    #define SET_BIT(var, bit)	((var) |= (bit))
    #define REMOVE_BIT(var, bit)	((var) &= ~(bit))
    #define TOGGLE_BIT(var, bit)	((var) ^= (bit))
    
    ....then...
    #define MY_FIRST_BOOLEAN BV00
    SET_BIT(myFlags, MY_FIRST_BOOLEAN)
    
    


  • Yes. This is basically the core of why capitalism eats itself.

    You don’t have to be evil or short-sighted to be a CEO, but if you don’t do evil and short-sighted shit to pump the share price there’s a high probability the board will replace you with someone who will.

    This is why I believe the government should hold stock and sit on the boards of any company that gets publicly listed. Much easier than tying yourself in knots with an adversarial system of complex regulations.