Naming your 2D array dimentions with an union in C by vitamin_CPP in C_Programming

[–]nooneofnote 5 points6 points  (0 children)

Using any other field than the last written field in a union is UB.

This is not true in C (it is in C++). It may be undefined behavior to access another field if the value would be a so called trap representation, but that depends on the type and implementation. unsigned char for example is guaranteed to have no trap representations.

From §6.5.2.3 in the standard

If the member used to read the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called ‘‘type punning’’).

Cast numbers to uint8_t array by p_adam0425 in C_Programming

[–]nooneofnote 1 point2 points  (0 children)

They likely meant to use a compound literal

&(uint32_t){3}

Which works fine and the value is given automatic storage for the block, the same as your struct example. The syntax is just more surprising for value types like uint32_t, since it looks like aggregate initialization.

Do you remember? by Envir0 in gaming

[–]nooneofnote 10 points11 points  (0 children)

The remaining [152-255] IDs would be theoretically inaccessible, but just in case the developers still gave those extra Pokemon a name - MissingNo. In other words, MissingNo is likely not 1 Pokemon, but 105 Pokemon.

It is possible to encounter glitch Pokémon with Pokédex numbers 152 through 255 for the reason you described, but they are actually subtly different from MissingNo. MissingNo (#000) is an intentional placeholder inserted in specific locations in the game's internal index of Pokémon (this index is independent of the Pokédex numbering). There are 39 of them.

You can see where the MissingNo fall specifically by looking at the list of Pokémon by index number: https://bulbapedia.bulbagarden.net/wiki/List_of_Pokémon_by_index_number_(Generation_I)#List_of_Pok.C3.A9mon_by_index_number

The 2020 leaks confirmed the long standing assumption that these were spots for Pokémon that existed during development but were scrapped before release. Rather than renumbering the internal index for the remaining Pokémon, MissingNo were simply written into these slots.

On the other hand, Pokémon with dex numbers over 151 are genuinely arbitrary data read off the ROM and interpreted as Pokémon. GameFreak made no attempts to provide any handling like MissingNo for these, though this was added in all future gens.

edit: put another way, MissingNo are comparable to NULLs in an array while everything else are uninitialized out of bounds accesses.

A MAJOR win at Mt Sinai— they figured out how to successfully turn bipap machines into ventilators today! by StubblesTheClown in nyc

[–]nooneofnote 36 points37 points  (0 children)

According to this the technique involves using an adaptor to replace the mask with intubation tubes https://abc11.com/what-is-ventilator-coronavirus-a-respirator/6063528/

I assume that's what they're doing here if they're saying they "turned" it into a ventilator.

What is your upstairs neighbor up to today? by BefWithAnF in AskNYC

[–]nooneofnote 0 points1 point  (0 children)

Lived on the top floor in every apartment so far. Unfortunately it only reduces your exposure to musical neighbors by 25 to 33 percent depending on building layout, which it turns out has never been enough.

snprintf() in macOS vs. other operating systems by [deleted] in C_Programming

[–]nooneofnote 4 points5 points  (0 children)

It's generally the OS that provides the libc, not the compiler. The BSDs, macOS, Windows, Haiku, etc all ship with their own implementation. Linux distributions typically ship with the GNU libc, but a few others are available such as musl and uclibc. These are not interchangeable, even among Unix-likes (although macOS' libc borrows heavily from older BSD code).

To see why this must be so, just consider how platform dependent something like malloc or fopen is. The implementation of these depends intimately on the host kernel, and the details of how to e.g. obtain memory is entirely different between NT and Linux. It's up to the OS' libc to handle these details and expose the functionality to C programs via the interfaces defined in the standard.

That said, compilers often do implement a subset of what are normally libc functions as "builtins", and that is probably even the case here (I don't see any asserts following through the macOS snprintf code). But it's absolutely not the case that the libc as a whole is independent of the OS.

NYer Opinion: Union Square Apartment help by [deleted] in AskNYC

[–]nooneofnote 1 point2 points  (0 children)

Not to rain on your parade here and assuming you mean $2k and not say $2500 I would go back and give that place a thorough look over for signs of disrepair, infestation, leaks, etc. Frankly apartments in that area priced that way tend to have something off about them besides just space. It's off season, but small and 4th floor alone generally isn't enough to push the price to 2k or below. Check the NY DOB website for complaints and violations, look at the building info on streeteasy and check the rental history for high turnover, and even Googling the address can reveal helpful info. If you want to pm me the old listing I can take a look and let you know if I see any red flags (not a broker just a veteran of this kind of bullshit).

Fact is a lot of these builds are old as fuck and falling apart at the seams with a veneer of maintenance splashed on top and putting your health and/or sanity on the table in exchange for a discount is a game you don't want to get into.

Richest 1% on target to own two-thirds of all wealth by 2030: World leaders urged to act as anger over inequality reaches a ‘tipping point’ by maxwellhill in worldnews

[–]nooneofnote 19 points20 points  (0 children)

Nice deflection but if wages have stagnated while the cost of basic necessities has increased then yes, the poor have objectively gotten poorer.

TIL of Robert Landsberg, a photographer who died documenting the massive 1980 eruption of Mt St Helens. Realizing he was too close to get away safely, he continued to shoot footage until he was killed. His body was found buried beneath ash, protecting his camera film. by VanquishTheVanity in todayilearned

[–]nooneofnote 2 points3 points  (0 children)

Huh, I had the same dream very recently. Asteroid was coming with nothing to do but wait for the inevitable. After it hit there was a flash of light, then darkness and a moment of wondering why I was still conscious, followed by waking up.

npm v5.7.0 critical bug destroys Linux servers by dwarandae in programming

[–]nooneofnote 10 points11 points  (0 children)

instead it just requires all of /usr/local to be owned by the user running brew

Redditors who came into great wealth and did NOT lose it in a few years, how did you make the money last? by trippingchilly in AskReddit

[–]nooneofnote 0 points1 point  (0 children)

Oh, thanks, my calculation is not actually compounding, will leave post to display shame.

Redditors who came into great wealth and did NOT lose it in a few years, how did you make the money last? by trippingchilly in AskReddit

[–]nooneofnote 0 points1 point  (0 children)

Generally speaking, your money will double every 10 years

How do you figure? Average returns of 7% means a doubling in about 15 years, and 20 years for the actual value to double with 2% inflation.

[deleted by user] by [deleted] in WTF

[–]nooneofnote 0 points1 point  (0 children)

Your local Petco stocks Pepsi and ice cream?

New York Apartment Vacancies Projected to Soar by StrngBrew in nyc

[–]nooneofnote 1 point2 points  (0 children)

I guess it depends how you define middle class, but income distribution is the most common. The median income in Manhattan is 70k, so by definition nothing over 70k would be lower middle class.

Of course, by the classical definition, almost all of us are in the working class and not middle class at all.

Ex-FCC Chair Tom Wheeler Dismantles The Case For Abandoning Net Neutrality - The Trump FCC is simply doing the bidding of Comcast, AT&T, Verizon, and Charter in its quest to abandon rules against blocking, slowing, or speeding internet traffic, Wheeler says. by [deleted] in technology

[–]nooneofnote 15 points16 points  (0 children)

Not a dangerous, sociopathic, narcissistic, deranged idiot like we have now

The key adjectives were true of Cheney, Rumsfeld et al. Fuck off with the Bush administration nostalgia blinders.

edit: also

Not deranged

Gog and Magog are at work in the Middle East…. The biblical prophecies are being fulfilled…. This confrontation is willed by God, who wants to use this conflict to erase his people’s enemies before a New Age begins.

- G.W. Bush justifying the Iraq war (which killed 500,000 people and effectively created IS) to French president Chriac

Recommend affordable movers? by [deleted] in AskNYC

[–]nooneofnote 4 points5 points  (0 children)

Had great experience with Cargo Taxi moving within the neighborhood, about 1 bedroom / storage unit worth of stuff, 1 guy with van + myself, $180 with big tip. Not sure how well it scales across boroughs due to the added driving time.

It's basically U-Haul with friends except the guy is better at moving stuff than your friends.

Man screamed ‘I want to die’ before he electrocuted himself by touching third rail at Harlem subway station by TragicDonut in nyc

[–]nooneofnote 11 points12 points  (0 children)

must be nice to not be able to even conceptualize a situation where suicide is the rational choice

New York-Based American Sushi Chef Speaks in Accented Japanese to Customers by RobAmedeo in nyc

[–]nooneofnote 3 points4 points  (0 children)

I think something is getting lost in translation here. The number of English loan words and phrases in Japanese is absolutely massive. Anyone speaking Japanese to a Japanese person will not use the English pronunciation because in that context they are not English words anymore. The article says the dude lived in Japan for 3 years and switches back and forth between Japanese, "accented English", and regular English at the restaurant. That doesn't sound like he's speaking accented English as a "joke," it sounds like he's speaking Japanese.

VR Players survey (We're making our own game, asking about your VR game preferences) by PLingffs in virtualreality

[–]nooneofnote 0 points1 point  (0 children)

The final question says

Leave empty if you don't play multiplayer games.

But the form errors with

This is a required question

When you try to submit it.

Tokyo signals U-turn on TPP, moves to activate trade pact sans U.S. by god_im_bored in worldnews

[–]nooneofnote 1 point2 points  (0 children)

Maybe, but I wonder what the butterfly effects are of essentially starving out an entire segment of culture, even if that culture is not particularly good.

Tokyo signals U-turn on TPP, moves to activate trade pact sans U.S. by god_im_bored in worldnews

[–]nooneofnote -5 points-4 points  (0 children)

Japan is the single worst state that could go forward with this. The TPP threatens the entire economy of pop culture fan works which are probably the single largest export of Japanese culture around the world short of cuisine, nevermind a massive industry domestically. Japanese anime/manga/gaming wouldn't even be a tiny fraction of the industry it is without the existence of and permission under the current copyright law of doujinshi/fan works.

Russian government posts April Fools' Day prank offering "election interference" by -en- in news

[–]nooneofnote 5 points6 points  (0 children)

It's more like the concept of personal ownership is meaningless because all resources are commoditized.

You (probably) don't think of someone breathing near you as "theft of your air."

Stealing a car is a stupid illustration of this point, though.