Better HN
topnewbestaskshowjobs
Log inSign up

fsckboy

8,214 karma · joined Nov 7, 2019 (7y ago) · 5,323 submissions

and those who were seen dancing were thought to be insane by those who could hear that there was no music.
Submissions

comment 1y ago · link · parent

you misunderstood what i said about the strlen field, but we agree, yes, it's in the header where it belongs.

I explained how returning the address of the string buffer instead of the address of the struct would give you a C compatible string that you could pass to other C library functions. If those functions are "readonly" wrt the string, everything is copasetic.

if those string functions update/write the c-string (which is in the buffer) the strlen in the header will now be wrong. That has nothing to do with my suggestion, and it's already "broken" in that way you point out. My "string free bytes field" suggestion will also be broken by an operation like that, so my suggestion does not make this data structure worse than it already is wrt compatibility with C library functions.

However that strlen and free bytes problem can be managed (no worse than C standard strings themselves) and strlen and/or free bytes are useful features that make some other things easier so overall it's a win.

comment 1y ago · link · parent

normal c string functions don't know about any of this package's improvements, I'm not sure you understand what the package does.

    +--------+-------------------------------+-----------+
    | Header | Binary safe C alike string... | Null term |
    +--------+-------------------------------+-----------+
             |
             `-> Pointer returned to the user.
his trick is to create a struct with fields in the header for extra information about the string, and then a string buffer also in the struct. but on instantiation, instead of returning the address of the struct/header, he returns the address of the string, so it could be passed to strlen and return the right answer, or open and open the right file, all compatible-like.

but if you call "methods" on the package, they know that there is a header with struct fields below the string buffer and it can obtain those, and update them if need be.

He doesn't document that in more detail in the initial part of the spec/readme, but an obvious thing to add in the header would be a strlen, so you'd know where to append without counting through the string. But without doing something like that, there is no reason to have a header. Normal string functions can "handle" these strings, but they can't update the header information. I'm just extending that concept to the byte at the end also.

this type of thing falls into what the soulless ginger freaks call UB and want to eliminate.

(soulless ginger freaks? a combination of "rust colored" and https://www.youtube.com/watch?v=EY39fkmqKBM )

comment 1y ago · link · parent

nooooo you don't understand. when the buffer is not full, the string will be zero terminated "in buffer" (which is how it works as is anyway). when the buffer is full, the "free count" at the end will do double duty, both as a zero count and a zero terminater

comment 1y ago · link · parent

neat, i like it, has some of the same ideas i've used in my string packages

but i did see a place to shave a byte in the sds data struct. The null terminator is a wasted field, that byte (or int) should be used to store the amount of free space left in the buffer (as a proxy for strlen). When there is no space left in the buffer, the free space value will be.... a very convenient 0 heheh

hey, OP said he wants to be a better C programmer!

comment 1y ago · link · parent

the paywall really cuts down on the readability of this story. a quick google showed plenty of news stories though, their shareprice dropped 40% on the market today.

I'd be curious what the numbers are for the "good" that this therapy does; is there any way that this therapy is still "worth it" at any scale? but I know little about this area so that's a fairly naive question.

comment 1y ago · link · parent

title! "These French villages have no more drinking water"

"Nearly 3,500 residents across 16 rural villages have been unable to drink tap water since July 10"

and "At this stage, statistically, there are no adverse health indicators demonstrating a health consequence for the populations of these villages."

comment 1y ago · link · parent

it would not be very long before any successful threat to the S&P 500 becomes part of the S&P 500. The king is dead, long live the king.

comment 1y ago · link · parent

>Yes it's patently unfair that I got that lucky

it's not unfair since you took the risk of potentially losing your original investment; you also put in the time to learn about baseball cards, while other people were interested in antiques and studied and bought those, also with a risk that what they bought would decrease in value.

Can I interest you in some Beanie Babies?

comment 1y ago · link · parent

>Billionaires, oligarchs, and other members of the uber rich, known as “elites”

it's a small point but, "elites" usually refers to those with good educational credentials who hold down white collar jobs at universities, newsmedia, law and finance firms, political campaigns, non-profits, etc., jobs they got because their parents know how to help them network and who can afford to pay their rent in major cities while they "pay their dues" as interns in these same organizations. Yes, they do have higher than average incomes, but I heard a great word for them (from a left-leaning source fwiw) who called them "the 19%". They are not the 1%, but they make up the rest of the 20% and they work for the 1%, and though they often have left leaning political ideals, it's human nature to want to defend what you have and feel you earned it, and also to pass it along and take care of your own children's futures. According to this guy, they control 2x the wealth that the 1% controls and flex a lot of political muscle.

Billionaires, oligarchs, and other members of the uber rich are generally referred to as just those things. The people behind this study I would guess are in the 19%, and by labelling the billionaires and oligarchs as elites, unconsciously they shed the shame of being elites themselves (Dartmouth? pure ivy league).

comment 1y ago · link · parent

it's not like we didn't know about safety back then, but computers were slow, memory was limited, compilers had to be small, optimization was rare, and C was screamingly fast.

At the same time, when major compiler vendors couldn't even get their Ada compilers out the door in project overruns measured in years, Mitch Kapor's 1-2-3 was written and took over the spreadsheet market (dethroning the incumbent Visicalc) and it was written in assembler, not even C, and barely had memory to spare on user machines (memory? there was barely address space left to spare). The tradeoffs were authentic, and there was zero enthusiasm for Ada among programmers or entrepreneurs looking to get products launched. The mainframe world could have been different but the personal computer software market was exploding in a way larger systems never did.

(oh and let me add, all the undefined behaviors back then were very clearly defined (perhaps over a small field of options) and extremely useful, and should have been left that way; shoot out a compiler warning or error if they get your panties in a bunch)

comment 1y ago · link · parent

>Please state claims clearly.

i don't know what you mean, you didn't come out and say it

comment 1y ago · link · parent

I was on the phone with my bank recently (I called them) and they wanted to send a code to my phone to confirm my identity. I agreed. In came a text with a code and the phrase "nobody from the bank will ever ask you for this code..."

comment 1y ago · link · parent

>Instead, Intel has embarked on an unprecedented and sustained campaign to shrink its business in response to a series of technical and financial crises.

it's not unprecedented, when companies' businesses contract, shrinking is exactly the right thing to do, not to mention that it's forced on them anyway.

comment 1y ago · link · parent

Yours is a fascinating take on the topic, I learned a lot, thank you. I'm left thinking that signs of autism could very well be encoded in the way you walk.

I'm asd myself, but i think i show it in speech patterns, not walking.

comment 1y ago · link · parent

maybe it's being 15 that sucks for 85%, and has nothing to do with high school at all.

comment 1y ago · link · parent

it's not hard to read for native speakers, but you have to go slowly, where ordinary reading is very fast. reminds me of the experiment that shows you can read words with all the letters scrambled if the first and last letter are not part of the scramble https://www.sciencealert.com/word-jumble-meme-first-last-let... I assume that works in any language? but that "reads" fairly quickly whereas this one here for me at least is a little slower

comment 1y ago · link · parent

I don't need recovery time afterward (apart from sleep), but when I'm surrounded by people who do I want some equivalent compensation, not because I feel I need it, but because I feel they are slackers (not saying they are objectively slackers, just saying that's how it feels to me). many compromises need to be made when sprinting all out, and in the aftermath what is restorative to me is cleaning up the technical debt while it's fresh in my mind and I can't understand that other people don't want to do the same thing.

comment 1y ago · link · parent

same type of strawman as inequitable distribution of wealth being a problem, or highest achieving members of society especially those born with advantages do not make good stewards of government

comment 1y ago · link · parent

>>Queue China cleans the air, but at what cost articles.

>Nit: You probably mean Cue, as in "That's your time to go on stage" not Queue as in "that's your place in line"

bone to pick: you missed your opportunity to cool-ly say "not queue as in hair worn in a long plait descending down the back"

comment 1y ago · link · parent

Buckminster Fuller's Oldest Surviving Dome Is At The Center Of A Big Development Dispute (with audio)

https://www.wbur.org/news/2019/03/07/buckminster-fuller-geod...

comment 1y ago · link · parent

95th%ile income, given to people with randomly distributed incomes? first law they pass: "we get to keep this job, we need to get rid of sortition, it'll never work!"

comment 1y ago · link · parent

>Poles vs trenches are a tradeoff discussion. FWIW I was once in construction digging trenches and I'm German, so I might be biased a bit.

when i got this far I literally thought you were making a joke about Poland.

comment 1y ago · link · parent

i don't have any special knowledge in this area, but just thinking about it idly while sitting here, "robbing their homes while they are away" comes to mind as a good proxy.

comment 1y ago · link · parent

afaik they are not accused of parking or jaywalking, but if you're suggesting that's also on their records, can't say I'm surprised, once a scofflaw, always a scofflaw

comment 1y ago · link · parent

I just took economics, this is what is taught at any school with a serious economics program. (it's non-serious, though still can be good, if calculus is not a prerequisite)

1166.

Ask HN: Where(s) is /usr/shar/dict/words maintained?

2 points · by fsckboy · 1y ago · 1 comment

1
383940
178