What Is Going to Happen With Whois? - <AUTHOR> https://motherboard.vice.com/amp/en_us/article/vbpgga/whois-gdpr-europe-icann-registrar <comment><USER2> How does this threaten the security or privacy of the Internet _at all_? Whois data isn't accurate even by horrible standards. They've tried to make it more stringent but I have domains of mine with the wrong address that I'm too lazy to update and it's been wrong for years now. No problem for my Whois records. And to get around whois records, if we as owners of domains want privacy, we have to deal with shady companies that effectively take control of our domain's ownership. Great for selling whois privacy products, but not at all good for internet security.

SSL certificates already aren't good enough to prove the legitimacy of an organization, not even EV ones. Why Whois data would be any use is beyond me.

<comment><USER3> I think it is weird to have a physical address for a domain. At least that should be optional.

Definitely is a pro-company and anti-individual concept. If you are a company no problem using your address. As an individual it is not private, do you want people who hate your site knocking at your door and your kid answers?

Then namecheap as whois guard and all that. Extra rent you have to pay to keep your privacy!

<comment><USER2> You can always use a PO Box, as I've done in the past. Extra rent, but useful.

<comment><USER4> Lao Tzu says that in preparing a defense you welcome an enemy. If we create from our thought and intent, why would we take steps? This thinking instantly puts most people into fear mode, but when you live it and nothing happens fear totally loses any gravity, these discussions are tiresome. People ramdomly go crazy and target people on the internet probably less often than home invasions on houses with unlocked doors. But again quantitative analysis brings us back into the fearful analysis mode and out of abundant loving mode. Hard idea to explain, and my analytical brain comprehends the woowoo, but woowoo is critically important in that thought.

<comment><USER5> It's not only about some trolls targeting the content creators. It's also about government, government officials and large (ethically challenged) corporations and "organized crime" that one needs to be on guard against. Even if you host with a provider in another jurisdiction who will resist revealing your information, the WHOIS data is a sitting duck. I don't think this piece of advice from Lao Tzu applies to our post-Snowden world. Definitely not for people who are against the powers that be (and on whom healthy democracies depend on).

</comment></comment></comment></comment></comment><comment><USER6> Thank god. I get somewhere between 2 and 10 spam emails to my dedicated whois address _every day_. Requiring the publication of email addresses with every domain is absurd and serves no purpose.

<comment><USER7> I don't get so much spam mail as I do phone calls - quite often from real call centers with real people asking about what sites they could create for me on the domains.

I have been _very_ tempted to register an ultra offensive sounding domain name just to get someone at a call center to ask me about it by name :-D

<comment><USER8> I own a handful of domains and have my real contact info in all of them. Aside from annual postal (!) mail from registrars offering to renew them at about 10x the normal price, I don't really get any spam from these that I've seen.

I never answer the phone if the caller ID is unknown, so I may be missing some there also.

<comment><USER9> Yeah, I was going to chime in. I've had an accurate whois for my domains since the early 2000s and at most I get a couple pieces of junk mail around renewal time. No idea if I get any spam from it, the spam filter seems to do a good enough job of junking that.

The idea of hiding the contact information never quite made sense to me. If you're a business, then you already have to provide an address of record to the state for certified mail to go to.

If, as a private citizen, I am running a controversial website then there are already institutes in place that will receive, process, and provide anonymity for your physical mailing address.

</comment></comment></comment></comment><comment><USER10> Whois belongs in an era where email servers were completely open, telnet and FTP were unencrypted, and people had .plan files for all the world to see. It should have died off 20 years ago.

</comment><comment><USER11> When investigating sketchy sites I have found that domains are pretty disposable and that trying to contact the admin or registrar from the whois data is pointless. They can just pivot to another domain at worst and they probably faked the data they submitted to register it to begin with leaving them unaccountable.

Services like Cloudflare on the other hand are fully complicit in making abuse easy on the internet. If you want something abusive taken offline it is better to go after whoever is hosting it instead of some pointer to where it is hosted, which is difficult when they are behind Cloudflare. If you want a laugh search Google for the terms "booter" or "http stress tester" and try to gauge the legitimacy of the results.

</comment><comment><USER12> RDAP is going to happen.

1) its UTF-8 clean 2) its JSON 3) its getting Oauth, so LEA requirements can be met while keeping personal data private 4) it uses web protocol underneath so 302 redirect works 5) its fully deployed in the RIR system for numbers, and has a global directory at the root in IANA.

RDAP is going to happen to WHOIS. Its long overdue.

(bias: I work on RDAP)

</comment><comment><USER13> I've always appreciated that .ca domains are private by default.

Even without whois, you can dig the IP address and find out their ISP (sometimes). I've had some success getting compromised servers shut down by reporting them to the abuse email address in the dig record. If you email amazon with the details of malicious AWS instance, they will notify the customer and/or kill the instance pretty darn quickly.

Does anyone know of an open source program that finds malicious IP's in apache / nginx logs and reports them automatically? I've been thinking of making this tool but it must exist already.

In my head, I call it the internet hygiene project. It's a slow and very unsexy way of dealing with the botnet problem, but I think it could make a positive difference. Admittedly, it'll only catch the low hanging fruit, but there is so much of it, I think it is a good start.

Apologies for going off-topic.

</comment><comment><USER14> Yes, I accidentally exposed my personal info for a new .us domain. Spam emails and phone calls immediately.

<comment><USER15> I had the same issue. Didn't realize .us required your info to be published. My registrar upsold me their whois guard service, but it sat unredeemedable on my account while spammers harvested my info.

</comment></comment><comment><USER16> Serious question:

Some months ago I was curious about buying a domain name. So I poked around on various reseller sites to find out the pricing. I couldn't buy it at the time.

Only a couple months later (I still couldn't buy the domain), I found the site had been registered. The domain was an obscure but novel sequence of letters; the likelihood that I and someone else came up with the sequence at the same time is objectively possible, but slim.

So, I can only conclude that list reselling DEFINITELY DOES happen, and yes, I am very mad. But there is of course nothing that can be done.

Now, when I want to find out what domains do and don't exist, I just use WHOIS, because I don't trust any of the "domain lookup" sites.

What do I do now? :(

</comment><comment> ryan-c I applied for "port 43" access to GoDaddy's normal whois records (still "domains by proxy" if private registration) this week. They require you to sign a very short contract stating what you're using it for and stipulating you can't bulk scrape it or use it for marketing.

Still waiting on approval, am somewhat interested to see whether they approve my request.

As far as spam goes, I don't generally use private registration, but use dedicated email addresses for my whois contacts, and I rotate them on a regular basis.

The scraping seems to happen soon after a domain is registered, but there's a much longer lag when changing the email address.

</comment><comment><USER17> Most recently I have found whois a good way to validate the age of domains of certain competing companies. This is a very vague thing to look up but it sure is useful, I am sure that it also adds a dimension to trust metrics in search engine and antispam land. I don't want it to die.

</comment><comment><USER18> Non-mobile link: [https://motherboard.vice.com/en_us/article/vbpgga/whois- gdpr...](https://motherboard.vice.com/en_us/article/vbpgga/whois-gdpr-europe- icann-registrar)

</comment><comment><USER19> On the other side of this, I remember a time when you could just download a dump of the registration data and do whatever you wanted (good or bad). Now it's like pulling an arm and a leg to get access to even fractions of the data.

</comment><comment><USER20> For .uk domains currently, you cannot mask whois details at all!

<comment><USER21> Nor .io domains.

<comment><USER6> My .io (finn.io if you want to look it up) says:

      Owner Addr    : Obfuscated whois Gandi-63-65 boulevard Massena
      Owner Addr    : Obfuscated whois Gandi-Paris
      Owner Addr    : WA
      Owner Addr    : FR

and my full name. Seems obfuscated enough, especially since the name was not remotely validated.</comment></comment></comment>


ExUnit Cheat Sheet - <AUTHOR> http://blog.lucidsimple.com/2016/01/31/exunit-cheat-sheet.html <comment><AUTHOR> ExUnit is Elixir unit testing framework. Some great tips in that post which reflect what I've been needing.</comment>


On the Phenomenon of Bullshit Jobs (2013) - <AUTHOR> http://strikemag.org/bullshit-jobs/ <comment><USER2> Repost, but a great article.

<comment><USER3> Interesting discussion from a previous posting:

[https://news.ycombinator.com/item?id=8561080](https://news.ycombinator.com/item?id=8561080)</comment></comment>


Li Ka-Shing teaches you how to buy a car and house in 5 years - <AUTHOR> http://therealsingapore.com/content/hong-kong-billionaire-li-ka-shing-teaches-you-how-buy-car-house-5-years <comment><USER2> So:

1\. don't be unemployed or under-employed (he clearly says it is your fault if so)

2\. don't get sick, not mentioned anywhere what happens then, does HK have universal healthcare?

This sounds a bit like McDonald's financial advice to their employees

[http://www.nbcnews.com/business/personal- finance/mcdonalds-f...](http://www.nbcnews.com/business/personal- finance/mcdonalds-finance-guide-insulting-low-wage-workers-f6C10653604)

btw, this guy made his money by buying cheap real-estate and got lucky when prices went up:

[http://en.wikipedia.org/wiki/Li_Ka- shing#Real_estate](http://en.wikipedia.org/wiki/Li_Ka-shing#Real_estate)

 _In reality, Li went to school for a couple of years and then started working for a wealthy uncle (from the family that owns Hong Kong 's Chung Nam Watch Co.). Subsequently he became part of an important subcategory of tycoons who got ahead, in part, by marrying the boss's daughter._

<comment><USER3> HK has one of the best public healthcare systems in the world (modelled after the NHS before handover, and benefiting from HK's prosperity after), and as a result does extremely well in infant mortality and life expectancy metrics.

<comment><USER2> This is actually great to hear. Now why doesn't the US, sigh.

<comment><USER4> US has reasonably good system IMHO just a little bit expensive.

<comment><USER2> A little bit?

There are many millions without insurance in the USA.

I was quoted $80 for an antibiotic I needed last week.

<comment><USER5> That's not fair. What antibiotic and how much of it? Not all antibiotics are equal.

You are right, the prices in our system are out of control but your example does not sufficiently demonstrate the problem.

</comment></comment></comment></comment></comment></comment><comment><USER6> I find it fascinating that that the consensus among the responses in this thread seems to be somewhere between Li Ka-Shing being a hypocrite, that buying food for people richer than you is crazy, that his advice is useless, etc.

Sure, there are cultural incongruities. Americans don't understand buying lunch for your superiors, and the advice to beat yourself up if you fail to see progress is directly opposed to the "do your best" attitude that lives on this side of the Pacific, but the lessons are the same.

In the end, the moral is simple: wheeling and dealing. Being crafty. Placing yourself in a situation where opportunities find you, not vice versa. Focusing your personal development on becoming competent enough to act on your opportunities.

What bugs me is that this sort of hustling is necessary to thrive in any business, not just software. I suspect HN's criticism of this advice might be a sign of wantrepreneurship rather entrepreneurship.

<comment><USER7> You completely misunderstand the "Curse of the Gifted".

The point of that article was that _hustle will only take you so far_ , and after that point real engineering projects require design and process, least of all because you need to interact with other people. Write software on a team, work on a large project, and you'll understand this better.

The things espoused by this guy are more a function of good luck and parasitism than hustle--do not mistake one for the other.

<comment><USER6> You're right, I did slightly misinterpret the post. I've removed it and supported my argument in a different way.

Also I don't appreciate the implication that I don't write software on a team for a large project, because I do.

</comment></comment></comment><comment><USER8> I don't see why a lot of people disagree with his advice. Perhaps it is the words he uses. These are his basic divisions of cash.

1\. Live cheaply. Don't waste money where you don't need to.

2\. Expand your network by being nice and friendly to people.

3\. Learn and invest in your future.

4\. Take time off, travel the world and expand your horizons.

5\. Save money. This is ideally used to start your dream. In reality, this can be used in times of trouble.

What's so bad about that? I think this is good advice for anyone trying to ``make it''.

<comment><USER9> I think the problem people seem to have is that it is standard, stereotypical advice. The entire premise is built upon the fact that you have a job that pays enough money to allow you to do the things he's suggesting -- people with untapped upward mobility.

If you're in a situation where you're working multiple jobs (or can't find any jobs) just to be able to "eat poorly", you won't have the time or money to network, invest in your future, travel, or save up.

</comment></comment><comment><USER10> I am from Hong Kong, the article appears to be a spam/fake article: [http://finance.sina.com.hk/news/-3-5652018/1.html](http://finance.sina.com.hk/news/-3-5652018/1.html) (Chinese)

<comment><USER11> Google Translate might not be very clear, but the article actually says that Li Ka-Shing denied authorship of this article on 20 February 2013. (Yes, 2013!)

This current resurgence is probably linked to an English translation being posted on e27 in the past 24 hours, before being subsequently picked up by TRS: [http://mirror.e27.co/li-ka-shing-teaches-buy-car- house-5-yea...](http://mirror.e27.co/li-ka-shing-teaches-buy-car- house-5-years/)

Just a note that The Real Singapore is not representative of Singapore's media scene.. while it is not quite an equivalent of The Onion, it is also not the first news source for most locals. I am quite embarrassed to see it linked to on HN.

</comment></comment><comment><USER12> >Famous theory from Harvard: The difference of a person's fate is decided from what a person spends in his free time between 20:00 to 22:00.

Anyone know the source for this theory? I'd like to know more about it but googling turned up nothing but links to this article.

</comment><comment><USER13> I actually like his categories:

        1. Living expenses - 30%
        2. Networking      - 20%
        3. Education       - 15%
        4. Travel          - 10%
        5. Savings         - 25%

But his living expenses category seems to exclude housing costs - is there some cultural peculiarity that accounts for that?

<comment><USER14> Probably the fact its somewhat expected for asian youths to live at home with their parents until they are well established

<comment><USER15> Which, in Hong Kong, is likely to happen when you are 35 and have kids already. All living in about 400~600sqft.

</comment></comment></comment><comment><USER16> _Well, after struggling for a year and if your second year salary is still RMB 2,000, then that means you have not grown as a person. You should be really ashamed of yourself. Do yourself a favour and go to the supermarket and buy the hardest tofu. Take it and smash it on your head because you deserve that._

This is hilarious. I wish people in western media would say things like this more often.

</comment><comment><USER17> "Always remember to buy lunch for people who are richer than you"

I have spotted a conflict of interest here.

<comment><USER18> Not to mention his ultimate paradox of spending money on others when you are poor and spend money on yourself when you are rich.

<comment><USER17> Apart from the impracticality of this advice, I found it strangely misanthropic. Essentially: "be generous now so you can afford to be even more selfish later".

</comment></comment></comment><comment><USER19> His pro-tip seems to be to get a 150% pay rise after 12 months.

<comment><USER20> To be fair, going from monthly income of RMB2000 to RMB3000 in a year is not a particularly difficult task. Most corporate types will get that just by showing up.

<comment><USER19> > By the second year, your income should be increased to at least RMB 5,000. > Minimum it should be RMB 3,000, otherwise you would not be able to keep up > with inflation.

He's saying to expect to go from RMB 2,000 to _at least_ RMB 5,000.

</comment></comment></comment><comment><USER21> [..] Well, after struggling for a year and if your second year salary is still RMB 2,000, then that means you have not grown as a person. You should be really ashamed of yourself. Do yourself a favour and go to the supermarket and buy the hardest tofu. Take it and smash it on your head because you deserve that.[..]

Hahaha smash your head with tofu if you don't get a raise. :))

<comment><USER22> The idea make me curdle!

</comment></comment><comment><USER23> "Living expenses" is not just food. What about rent, utilities, taxes, health, debts?

<comment><USER24> As others have pointed out, the (regional) expectation may be that the subject is living at home with their parents (rent / utilities), that there's state- provided healthcare and education (debt). At this income level you might not be paying much income tax, either.

~30% of my post-tax take-home goes to rent, which is pretty typical in the US. If I didn't have to pay that, I'm sure I could save a bunch more!

</comment></comment><comment><USER25> "Well, after struggling for a year and if your second year salary is still RMB 2,000, then that means you have not grown as a person. You should be really ashamed of yourself. Do yourself a favour and go to the supermarket and buy the hardest tofu. Take it and smash it on your head because you deserve that."

The supermarket is fresh out of hard tofu...

</comment><comment><USER26> 'The problem with quotes on the Internet is that it is hard to verify their authenticity.' \- Abraham Lincoln

</comment><comment><USER27> His "network" advice is really just "how to use people", and it's reprehensible.

</comment><comment><USER28> Is this guy for real?

<comment><USER29> Nope, it seems to be a hoax.

</comment></comment><comment><USER30> _Suppose your monthly income is only RMB 2,000, you can live well. I can help you put money into five sets of funds. The first $600, second $400, third $300, fourth $200, fifth $500._

Da fuq? Are we talking about renminbi or dollars here? Either way... terrible article.

<comment><USER31> the "$" sign is often used as a general currency sign.

Since 600+400+300+200+500 == 2000, the article is obviously talking about renminbi. And it doesn't matter a lot.

The writer probably didn't have a 元 or a ¥ on his keyboard and didn't know about ¤.

</comment></comment><comment><USER27> > _Well, after struggling for a year and if your second year salary is still > RMB 2,000, then that means you have not grown as a person. You should be > really ashamed of yourself._

Lost all credibility right here.

</comment><comment><USER32> Follow this and you will become a billionaire too?

</comment><comment><USER33> Did I miss it or did he leave out rent?</comment>


Comcast, Cox, Frontier All Raising Internet Access Rates for 2018 - <AUTHOR> https://www.digitalmusicnews.com/2017/12/19/comcast-cox-frontier-net-neutrality/ <comment><USER2> False clickbaity title. The body of the article claims only Cox is raising any rates on _internet_ access; the other rate rises are for _content_ (programming) _only_ , not for the pipe or data volume through their pipe.</comment>


AWS Outposts: Run AWS infrastructure on-premises - <AUTHOR> https://aws.amazon.com/outposts/ <comment><USER2> If I'm understanding this right I run a VM (or let this process have access to my host) and then I can spin up AWS services on my local host? So I can have a development SQS queue that is run locally and then when I move to the cloud I can just change the config to point to the cloud version? And this is...? Free? I can't see anything about pricing.

If this is true this is amazing as it lets you prototype with AWS services for the cost of hardware.

<comment><USER3> No, this is more like a rack that you buy from AWS at AWS pricing. I see people using AWS Public for development and "air gapped" [1] AWS Outposts for production.

[1] not really

<comment><USER2> Ahh ok, thank you for clarify. This makes more sense even if it makes me a little sad. I'd love to use AWS for side/hobby stuff and then use the cloud- version once I was ready to launch something. I just can't justify paying $7 minimum a month for a VM when I have 2 cloud servers and 3 home servers already that are all more powerful.

I hate that for AWS you have to either pay to develop or use hacky semi- equivalents locally and hope it works when you go to the cloud.

<comment><USER4> They have a free tier for exactly this purpose. Almost all the services have pretty reasonable free tiers.

<comment><USER2> But AWS (maybe others as well) only lasts for 1 year and lambda and stuff might have higher free tiers but stuff like EC2 barely covers a T1 micro IIRC.

<comment><USER5> You can sign up new accounts, even on the same credit card. Additionally I believe that if you contact support and agree for them to wipe all the resources in your account - you can have another year of free tier again.

And of course, you're deploying all your stuff automatically anyway right? So wiping the account doesn't really matter.

</comment></comment></comment></comment></comment></comment><comment><USER6> I'm surprised to see this - I thought Azure On-Prem would have this market to themselves, to be honest.

This will be the death of a lot of the smaller virt/hybrid cloud business models, I suspect.

<comment><USER7> Most of their margins are value added services not hosting. This actually takes the capital expenditure off their plate so they can focus on the high margin services.

</comment></comment><comment><USER8> I've always been suspicious that you could roll your own aws if the volume justified the effort. Feels like this may have the unintended side effect of inspiring clever CIOs to consider doing this without Amazon.

</comment><comment><USER9> This is kinda Amazon offering their own version of Eucalyptus, just 10 years later: [https://en.wikipedia.org/wiki/Eucalyptus_(software)](https://en.wikipedia.org/wiki/Eucalyptus_\(software\))

<comment><USER10> Disclosure: I work for AWS doing many things, including Outposts.

Only if all of regional ("in the cloud") EC2 and EBS services had been re- platformed to run on Eucalyptus.

A significant difference here is that the same infrastructure building blocks used for EC2 and EBS are used for Outposts, and the same regional control plane endpoint is used to create and manage resources. It isn't a second implementation that operates similarly to the regional cloud version.

Additionally, all of the control plane components that are used to drive the infrastructure in the way your API requests intend run in the regional cloud, which leaves practically all of the Outposts resources available for customer workloads.

</comment></comment><comment><USER11> Where can I find the full list of products being released during AWS re:Invent? I haven't been able to find it, if there is such thing.

<comment><USER12> [https://aws.amazon.com/new/reinvent/](https://aws.amazon.com/new/reinvent/)

</comment></comment><comment><USER13> The rate at which the aws team is executing new ideas is phenomenal.

<comment><USER6> Not really a new idea - very much a me-too of Azure on-prem, and still quite a bit behind them. I'm more surprised that they were able to run this politically.

<comment><USER14> "available next year"

<comment><USER15> aka 4 weeks... so what?

<comment><USER16> Technically "next year" is 4-56 weeks from today Nov 29.</comment></comment></comment></comment></comment>


Billing Incident Update - <AUTHOR> http://www.twilio.com/blog/2013/07/billing-incident-update.html

<comment><USER2> Very well handled. Facts, gestures of good will, and straight-forwardness.

Call me crazy, but I tend to think issues like this ultimately serve, if handled well, to _improve_ a company's public standing.

Though I suppose that depends on how one defines "well"...

<comment><USER3> In 1982 some nutjob went around to supermarkets and pharmacies and put potassium cyanide in Tylenol bottles. Johnson & Johnson responded by issuing a recall for ALL Tylenol products nationwide. This incident is anecdotally credited with having directly led to those paper or foil seals on over-the- counter pill bottles.

[https://en.wikipedia.org/wiki/Chicago_Tylenol_murders](https://en.wikipedia.org/wiki/Chicago_Tylenol_murders)

<comment><USER4> Wow. That is utterly tragic and horrifying.

</comment></comment></comment><comment><USER5> It was surprising to read they will be reimbursing any overdraft fees caused by the problem. Good move.

<comment><USER6> Why are you surprised they are reimbursing overdraft fees? That is the bare minimum that I would expect from any company which made this mistake

<comment><USER7> Of course it is to be expected, but unfortunately one cannot expect it happen. If you get it?

<comment><USER8> In this case, I think one can. If they cause damages due to negligence (or malice), they are liable for those damages. Only the dumbest of dumb companies would refuse to reimburse overdraft fees in a case like this, because doing so will open them up to lawsuits from every single affected person, lawsuits which those people basically cannot lose.

</comment></comment></comment></comment><comment><USER9> Simple, honest, open and straight to the point. Nice to see that they recognise it's not just about the money, but the trust people had in Twilio. I'm looking forward to reading the promised post-mortem, because I can't recall reading one from them before.

<comment><USER10> It has been some time since we have had an incident this disruptive for our customers. Looking forward to delivering that investigation summary to you as soon as we feel we got it right.

</comment></comment><comment><USER11> This is about as good as you can handle an incident like this, PR wise.

</comment><comment><USER12> Congrats to Twilio on a textbook example on how to handle a billing outage. While I hope to never to through this I do admire a team that can execute like this.

Cheers, from one telco nerd to your team of hackers.

<comment><USER10> Always appreciate your support Josh. much work to do before this incident is resolved fully.

</comment></comment><comment><USER13> So many updates on their status page! One of the first companies I felt like I knew wtf was going on during the issue.

<comment><USER14> And you can see status from two years ago! Google won't even recognize that gmail is down unless 5% of requests are failing (!!!! Try getting your work done all day if 1/20 actions fails.)

<comment><USER10> Very glad you found the stashboard useful during the incident. This is actually one of my favorite open source projects of ours.

If you would like a similar service for your company, check it out here: [http://www.stashboard.org](http://www.stashboard.org)

</comment></comment></comment><comment><USER15> Interesting. I just came back from an event here at Lone Star Ruby Conference they sponsored (movie - they used Twilio powered service to pick the movie we watched at a local brew theater). Would have made for some interesting questions had more known about this problem :-)

</comment><comment><USER16> Why not batch process billing every hour or 30 minutes? That way you can run simple checks to look for anomalies.

<comment><USER10> It's a good question. As our service is delivered through a utility pricing model, most of our API requests are billing events - each call, text message or recording ends up having a debit to the account balance associated with it. As you can imagine then, our auto-recharge feature could be called any moment to make sure the balance doesn't run out.

That said, we do have the monitoring you describe in place which is how we were alerted to the incident and limited the damage to 1.4% of the account base.

</comment></comment><comment><USER17> Twilio should really consider a lighter gray color for their text on the white background. Right now the text is simply too legible still! Why, I can almost read it, if I crane my neck and look at the screen at just the right angle. What could they have been thinking? Hopefully they will take this feedback to heart so that future urgent messages like these will be completely obscured.

<comment><USER7> Kinda ironic that this comment shows up as light grey on a grey background. :)

<comment><USER10> Appreciate the feedback. Will get it fixed.

</comment></comment></comment><comment><USER18> Nice response, bad text color. The gray on bright white background really strains my eyes. Ouch.

<comment><USER19> I use iReader extension whenever the website's color scheme strain my eyes too much. It's essentially a clone of "Reader" functionality on safari.

[https://chrome.google.com/webstore/detail/ireader/ppelffpjgk...](https://chrome.google.com/webstore/detail/ireader/ppelffpjgkifjfgnbaaldcehkpajlmbc?hl=en)

<comment><USER10> Good feedback. Thank you.

</comment></comment></comment><comment><USER20> That's how it is done. Classy.

</comment><comment><USER21> For anyone looking for multiple (redundant) SMS provisioning, I have had not perfect but pretty good experience with [http://fortytwotele.com/](http://fortytwotele.com/) over a good few years. I am not connected to them at all, just throwing the option out there. As a bonus, they're European, which means you are better positioned for compliance with EU privacy laws for non-US clients.</comment>


Depressing and faintly terrifying days for the C standard [pdf] - <AUTHOR> http://www.yodaiken.com/2018/05/20/depressing-and-faintly-terrifying-days-for-the-c-standard/ <comment><USER2> At Microsoft the compiler team (Visual C++) and the Windows team are joined at the hip. I'm sure the same was true at Sun. This can lead to good decisions about undefined behavior that I hope would make Linus smile.

I recently learned of one such good engineering decision (I hope I'm remembering it correctly). Let's say you have a struct with an int32 and a byte in it. That's 5 bytes, right? But the platform alignment is a multiple of 4 bytes, so there's 3 bytes of padding (sizeof the struct is 8 bytes). If we stack-allocate an array of 11 of these and zero-initialize with = { 0 }, what would you expect to see in memory after initialization?

It turns out the answer _was_ that the first element of the array would have its 5 bytes zeroed, but the 3 bytes of padding would be left uninitialized. Then, the remaining 10 elements of the array would be zeroed with a memset that actually zeroed all 80 remaining bytes. It sounds weird but this is a legal thing to do from the standard's perspective. All they're obligated to zero out are the non-padding bytes. This UB was leading to disclosure of little bits of kernel memory back into user mode because Windows engineers assumed that = { 0 } was the same as leaving the variable uninitialized and then memsetting the whole thing to zero. Nope!

The compiler team fixed this by always zeroing out padding too. Problem solved. There are some cases where it's not quite as fast. But it's the right engineering decision by the compiler team for their customers, both internal and external.

<comment><USER3> The problem with this kind of approach is over time it removes the ability to use any other implementation. You are no longer using C, you are using <Implementation>C.

This becomes a problem when a different implementation adds amazing tools for finding bugs (the sanitizer suite, for instance), and you can't use them because your code doesn't build with any other implementation.

<comment><USER4> Luckily clang does a good job at being GCC compatible, so I don't worry too much about using GCC extensions. It's quite unlikely one of them will go away anytime soon, and theory pretty much cover all architectures/platforms that have ever existed.

<comment><USER5> Usually true, unless you want to target embedded, mainframes or some industrial OSes.

</comment></comment></comment></comment><comment><USER6> Like phkahler, I don't want C to grow any more. I've been a C programmer for a long time, the vast majority of my day-to-day work is still in a C codebase, and I expect to continue working in C for a while yet. Nonetheless, its time has passed. It will be around for a while, just like FORTRAN and COBOL are, but there's no good reason for new code to be written at that poor level of abstraction. Even for systems software - what I write - there are always better choices that provide higher-level data and control structures. They variously use garbage collection, reference counting, ownership rules, or whatever you call that hot mess C++ has. Writing safe, secure C code is certainly possible, but it's too much unnecessary work - especially in the concurrent and/or parallel world that any non-trivial code has to live in nowadays.

That said, I really wish proponents of other languages would get their stuff together about creating libraries that can be used from other languages. A library written in C can be used by anyone else. Many other languages are avid consumers of this functionality, many advertise it as a key feature, but very few return the favor by _producing_ reusable code. The industry doesn't need such Balkanization. If you're one of the very many people who look down their noses at C and want to get rid of it, do your part.

<comment><USER7> >A library written in C can be used by anyone else.

This is because of how much of the unix clone ecosystem has been built around C workflows, and this wasn't true on Windows until linux compatibility was developed on it.

>If you're one of the very many people who look down their noses at C and want to get rid of it, do your part.

convincing linus and sysadmin greybeards to modernize linux and is no small task, until then we'll all still be just be scripting over archaic C apis

"science progresses one funeral at a time"

<comment><USER6> > This is because of how much of the unix clone ecosystem has been built > around C workflows

Absolutely correct.

> convincing linus and sysadmin greybeards to modernize linux

That's not what I'm suggesting. Anything that's already written in C can and probably should continue to be so. What I'm suggesting is that people who prefer to work in other languages should have an easy way to make their work available beyond their own language community. I'm not talking about interpreted/scripting languages here. I'm talking about compiled/systems languages. Stuff that gets linked together, or that should be able to use some sort of dlopen/FFI back and forth fluidly despite multiple languages being involved. There's some work to be done there, but everyone seems to prefer hiding in their own language bunker instead of reaching out to others.

<comment><USER8> The problem is that other languages necessarily place more restrictions on how their data can be used in order to gain all their nice features. Since you can't control the caller you lose all those guarantees. Because of that it will never be easy to interop across higher level languages. C works well here because its low level enough that it expects few guarantees. Just keep the stack aligned and balanced and it will mostly be happy.

</comment></comment></comment></comment><comment><USER9> I also think that the committee is out of touch. C99 was an awesome improvement on the language, and since then, it went downhill. We don't need the extra weird C11 syntax things, duplicating of existing libraries; we want tools that scope C better, or extensions that have been proven helpful and stable (one such example is the switch(x) { case A...B: } from gcc!).

I want strict boundary checking, I want an array base type that can't be cast as a pointer. I want some sort of scoping mechanism (ie, blocks), I want a bit of standardisation of memory barrier and such. I want #pragma once FFS -- it was proven a good idea for 25 years.

Basically there's tons of stuff that could help make the language better -- C99 did that; C99 is a masterpiece for example on how you can statically initialise extremely complex data into a single block, without having to use code. It's used all over the Linux kernel (amongst other thing; for example my own simavr is heavily based on that feature [0]).

* Standardise the stupid bit order in bitfield declaration FFS. I've been wanting to use that feature for 30 years and I can't because they 'forgot' to make up their mind!

* Coroutine standardisation would be awesome (stack swap primitives, with boundary checks etc)....

* gcc 'sub functions' (or a derivative) would be awesome if improved to make them safe.

* Reference counted allocator (basically, get libtalloc and roll it in [1])

There are so many things that could be improved, without diverging into weird stuff nobody _needs_ (complex math anyone??!?!).

* In fact I want SIMD. I don't need these complex types.

[0]: [https://github.com/buserror/simavr/blob/master/simavr/cores/...](https://github.com/buserror/simavr/blob/master/simavr/cores/sim_megax.h)

[1]: [https://talloc.samba.org/talloc/doc/html/index.html](https://talloc.samba.org/talloc/doc/html/index.html)

<comment><USER10> Honest question. You keep expecting all of these to be readily available for you in C (as part of the standard). Why don't you, instead, just a use a language/ecosystem which already offers all (or most) of these for you today? (ie. D/Go/Rust/Nim)

> "* Reference counted allocator (basically, get libtalloc and roll it in > [1])"

Why and how should that be standardised exactly? Memory allocation is platform-dependent, hardware-dependent and generally case-specific. malloc() and free() are the lowest common denominators the standard can assume, anything beyond that is simply restrictive. If you need a "reference counted allocator", why not just find/implement one that simply suits your needs?

> "* Coroutine standardisation would be awesome (stack swap primitives, with > boundary checks etc)...."

Again, what makes you think this can be standardised across the infinite span of platforms and compilation-targets, where C is often used?

> "* In fact I want SIMD. I don't need these complex types."

I'm not following your point. You're simply asking for a better abstraction for SIMD. Also, as I'm sure you're well aware, SIMD is not available everywhere. Wherever available, you have clear instruction-set APIs/ABIs you need to follow to make it work. What else is missing?

<comment><USER9> I don't see your point. There's tons of stuff in C11 for example that is not applicable to a vast majority of where C is used. Even in C99 basic stuff as 'floating point' or 'malloc' is not available on many hardware, that doesn't stop having a standard way of using them /when applicable/.

I know there are traps to fall into -- when I see people writing floating point code on an 8 bit AVR, I cringe, but well, 'it works'.

As far as changing language, you just answered your own question by mentioning 4 of the myriad of them that aren't ported on as many platform as C, requires runtime of unknown quality, and also requires a body of developers that... doesn't exist.

I've had a long enough time in the industry to have seen quite a few times a whole bunch of software done by someone who was following the fancy trendy language of the day, and required a complete rewrite in... C to be able to move on from it.

Heck, _I 've_ done similarly as well, done 20+ years of C++, gradually trying to scope down the subset of what I was using to then realize I just might be better of with plain C -- and magic happened -- stuff still compile/work years after they were made... And anyone/everyone can just dive in and use the codebase.

</comment></comment></comment><comment><USER11> I found the title a little misleading: there isn't much about where the standard is heading or even where it's been.

I would vote for the title "a rant on undefined behavior in C."

——

Simple example: the article complains that unsigned integer overflow is defined in C while signed integer overflow is not. There is very little in the article about this except for the claim that the performance for incrementing a signed int should match the performance for incrementing an unsigned int. The writer refuses to believe otherwise, even though he accepts that undefined behavior "supposedly" allows the compiler to omit overflow checks.

It's the "supposedly" that makes this a rant. The article's sources mention that Clang does omit overflow checks and that the Clang team believes this makes loops up to 20% faster ("up to" because the optimization can't be applied to all loops, and the performance increase will depend on how tight the loop is, i.e., how much overhead there is in incrementing and testing the loop variable in comparison to the loop body).

<comment> loup-vaillant > _the article complains that unsigned integer overflow is defined in C while > signed integer overflow is not._

The article complains that signed integer overflow is undefined, while unsigned integer overflow is not. There's a difference.

> _the Clang team believes this makes loops up to 20% faster_

I'd love to see the benchmarks they conducted. Anyway, undefined behaviour was the wrong way to solve the problem. The C language should have grown a `for` loop that's more than a thin veneer of syntax sugar over `while`. Seriously, how hard would the following be?

      for (int i = start; end)) {
          // body
      }

No explicit comparison, evaluate `start` and `end` at the start of the loop, maybe cast them to the type of i, and increment implicitly. While loops can handle the weird cases. There you have your 20%.

<comment><USER11> > > the article complains that unsigned integer overflow is defined in C while > signed integer overflow is not.

> The article complains that signed integer overflow is undefined, while > unsigned integer overflow is not. There's a difference.

You are correct.

> > the Clang team believes this makes loops up to 20% faster

> I'd love to see the benchmarks they conducted.

It wouldn't surprise me if they have micro benchmarks. I convinced myself they were telling the truth based on crude instruction counting: a loop must be converted into something like:

\- loop body (assume it contains at least one machine instruction)

\- increment loop variable

\- (for unsigned): clear overflow flag

\- test loop variable, exit loop if appropriate

\- goto beginning of loop

I believe they don't have to actually check the overflow flag, it's OK to let the overflow happen. But they do have to clear the flag to avoid a spurious error if the flag gets looked at later.

I'm no expert, so it's possible this oversimplifies things, but removing the instruction to clear the flag does remove a big chunk of this loop. But it's a big chunk _only_ because it's a tight loop.

For the record, I happily use the foreach loop constructs in C++, D, Java, C#, Python, Perl, etc. but I originally avoided them until I saw a comment by Walter Bright that there is no performance penalty in D (the compiler rewrites the loop appropriately; there may be a penalty in Java because the feature might be defined in terms of their relatively heavy iterators).

<comment><USER12> Microbenchmark can be very misleading compared to real impact in real programs. Still, the gains allowed by UB of signed overflow (when you are lucky enough that this transformation is actually correct in the context of what the original programmer had in mind...) are positive and probably measurable even in real programs, or if hardly measurable, maybe they at least permit a few percent of whole system perf improvement when using SMT processors. But they are more suited to other programming language than C, and actually yes, in C++ (and probably in most languages at this point) it is better both of code readability (most important!) and performance (nice to have, but very secondary compared to code readability) to use for each constructs compared to maintaining an index yourself.

Technically there is no overflow flag to reset, it is just that some CPU instruction sets do not support indexing with a 32 bit register when using 64 bits addressing, so you have to insert an extra sign extend instruction if you want to support 2s-complement signed overflow on 32 bits indexes. So you typically already don't have any cost if your indexes are already size_t/ptrdiff_t, but ptrdiff_t signed overflow is _still_ UB according to the C standard, which is also a shame, because it allows for far less interesting "optimizations" at this point (maybe a + w >= a --> true if w is positive, but that's actually typically dangerous, because that was historically what was used to check for overflow at source level, and now the compiler is suppressing all the checks!)

So all of that really only are trade-offs, and in the modern age (with e.g. a security picture that is kind of worrying, etc.) some people are arguing that this was a terrible idea to use this approach so carelessly, in their opinion. Most experts now think that no non-trivial codebase exist with no potential UB in it, so it is not just rants all around, some even are working on the mathematical model of the llvm optimizer to make it actually sound (for now even internally, it seems that it is not -- so unfortunately with this approach of optimisation for now there is no mathematical justification as for why the optimizations performed are actually correct even with the hypothesis of strict conformance to the C standard, so I let you imagine what happens in practice when almost no program is actually conforming...)

<comment><USER11> If there are microbenchmarks, I didn't write them. And I'll acknowledge that my instruction-counting approach has limits, especially since I don't really know the details of the platform. And my approach also doesn't account for pipelining.

But I would expect someone complaining about this optimization to do more than simply hand wave with a "supposedly." They could instead say that the optimization can be applied when the compiler can prove x < x + 1, which it can show when both the beginning and end of the loop are known at compile time. In fact, I think it's better to say "omit the pessimization that applies when the compiler has to allow for overflow."

But going no farther than labeling it a "supposed optimization" turns the complaint into a standard rant.

</comment></comment></comment></comment></comment><comment><USER13> Direct link to PDF: [http://www.yodaiken.com/wp- content/uploads/2018/05/ub-1.pdf](http://www.yodaiken.com/wp- content/uploads/2018/05/ub-1.pdf)

</comment><comment><USER14> You are invited to bring forward concrete proposals for changes to the C standard in the relevant committee.

[http://www.open-std.org/jtc1/sc22/wg14/](http://www.open- std.org/jtc1/sc22/wg14/)

Since UB allows the compiler to do anything in those situations, we can reduce the amount of UB without breaking existing "legal" code. By actually defining more behavior.

If a proposal is reasonable needs to be discussed in the standardization committee. All other discussions are a nice hobby. But eventually moot.

<comment><USER15> Here is a start. [https://docs.google.com/document/d/1xouelPcphQ-o7DmdSwz5UcL4...](https://docs.google.com/document/d/1xouelPcphQ-o7DmdSwz5UcL42M6bdA3t93Nm_5Hbomc/edit?usp=sharing)

<comment><USER14> If desired, I can comment your document over a private channel. In that case, please give a short heads-up when ready.

Note that I am not directly affiliated with WG14. So take my comments with a grain of salt.

<comment><USER15> i think you should be able to make private comments on that document. Otherwise firstname.lastname@example.com

</comment></comment></comment></comment><comment><USER16> My understanding is that a lot of undefinedness in the original c89 standard came from a desire to support non 2 complement machines like Burroughs. Of course in hindsight that was a total mistake. Yes would be a great idea to come up with an modern update to the c standard that is specified on let's say the level of java.

<comment><USER17> There's also the fact that registers may be larger than the numbers stored in them.

The best known example is that of the 80-bit floats of the 8087 FPU, but that's relatively rare compared to loading integers into larger registers.

For example, if you compile

       if( foo + 10 > bar) goto baz

to assembly similar to

       move foo to R1
       move bar to R2
       add 10 to R1
       subtract R2 from R1
       branch-if-greater-than-zero baz

and _foo_ and _bar_ are 32-bits, that _add_ can overflow if R1 and R2 also are 32-bits, but never overflows if R1 and R2 are 64-bit. That changes the result of the comparison if, for example

       foo = INT_MAX
       bar = INT_MAX

The designers of the CPU with 64-bits registers may not want to add variants of _add_ (and _subtract_ , _mult_ , etc) that work on 32 bits (and 16 bits, and 8 bits).

They also won't want to have their C compiler slowing down this kind of code, only because other (often relatively old and slow) CPUs exist.

<comment><USER18> But that's trivially solvable (on x86 at least). You do your arithmetic in rax and then compare the result in eax. You've got the "mask the high 32 bits" operation for free. At worst you'll need to do one bitwise and before using the value for cases where the high bits being poisoned matters. Or let me add annotations to arithmetic expressions that "this expression will definitely not need expensive cleaning up afterwards, promise", which I will need to use in maybe a dozen super-hot loops in the whole codebase. FWIW, we compile all our code with -fwrapv and don't notice any slowdown.

<comment><USER19> Of course it's trivially solvable in x86-64 because it has a full complement of 32-bit operations inherited from its x86 lineage. The GP is presumably talking about _other_ architectures when he mentions designs that might not want to add a full complement of 32-bit operations.

In any case, the problem doesn't really apply to x86 because all x86 compilers I'm aware of use the "expected" size for the various types rather than larger- than-needed-for-speed, exactly because the smaller operations are all generally available.

</comment></comment></comment></comment><comment><USER20> It's really annoying

It seems the committee is more interested in adding optimization gotchas (that nobody cares about for the most part) while making it impossible to write correct code without relying on convoluted code (which denies the benefit of "extra optimization") and "UBing everything"

C is broken, let's face it

\- Builtin strings are a joke. stdlib functions are even worse.

\- It was not developed with modern systems in mind.

\- DIY Memory management: malloc/free is like giving a kid a chainsaw to play with. Sure, every C programmer had to work out with this crap. But yeah, please complain how my static void * should really be a volatile char * . Idiot. (of course it's not wrong to complain, but that's like complaining about a faulty blinker in a car without brakes). And of course the compiler is going to ignore the 'volatile' part of the pointer because f. you and item 7c of paragraph 3 of the spec lets us do that, even though it is blatantly stupid to do so.

Rust is a step in the right direction.

Making string and (memory) slices a _fundamental_ part of the language helps. You can have null-terminated memory pointers for interoperability, but having it as a fundamental construct eliminates several problems. Also greenlets/threads/multiprocesses.

<comment><USER5> C was broken from the beginning if you go search what compiler researchers from Algol school of languages had to say about it during the early 80's.

"Oh, it was quite a while ago. I kind of stopped when C came out. That was a big blow. We were making so much good progress on optimizations and transformations. We were getting rid of just one nice problem after another. When C came out, at one of the SIGPLAN compiler conferences, there was a debate between Steve Johnson from Bell Labs, who was supporting C, and one of our people, Bill Harrison, who was working on a project that I had at that time supporting automatic optimization...The nubbin of the debate was Steve's defense of not having to build optimizers anymore because the programmer would take care of it. That it was really a programmer's issue....

Seibel: Do you think C is a reasonable language if they had restricted its use to operating-system kernels?

Allen: Oh, yeah. That would have been fine. And, in fact, you need to have something like that, something where experts can really fine-tune without big bottlenecks because those are key problems to solve. By 1960, we had a long list of amazing languages: Lisp, APL, Fortran, COBOL, Algol 60. These are higher-level than C. We have seriously regressed, since C developed. C has destroyed our ability to advance the state of the art in automatic optimization, automatic parallelization, automatic mapping of a high-level language to the machine. This is one of the reasons compilers are ... basically not taught much anymore in the colleges and universities."

\-- Fran Allen interview, Excerpted from: Peter Seibel. Coders at Work: Reflections on the Craft of Programming

However, C and UNIX are symbiotic, so there is no way we can get rid of C, while keeping POSIX based OSes around us.

So, it will stay around for many decades until quantum computers or something else eventually takes off.

</comment></comment><comment><USER21> I've the feeling that only a language fork from the GCC/clang teams could have any chance to success. It looks like the C standard committee is not interested in changing point of view.

<comment><USER22> GCC and Clang have already essentially forked the C language. Perhaps the most important C project—the Linux kernel—is written in the GNU dialect of C.

<comment><USER5> Although Google has managed to compile it with clang, as they removed gcc from Android.

<comment><USER22> Right, that's the point—a useful C compiler nowadays needs to be a GNU C compiler, not a standard C compiler.

<comment><USER5> To reinforce your point that is also how Microsoft decided to go on Azure Sphere.

[https://www.mediatek.com/products/azureSphere/mt3620](https://www.mediatek.com/products/azureSphere/mt3620)

</comment></comment></comment></comment></comment><comment><USER23> I want C to not grow any more. The problem with having groups to oversee things is that they usually feel the need to change or grow the thing they're supposed to be watching. Sometimes this is good, but often it's not. C is the foundation of a lot of stuff, and it'd be better to rewrite that stuff in a better language than to try and turn C into something it's not - that's what C++ was for.

<comment><USER24> Well, you're in luck. A lot of people don't care to use anything beyond C89.

<comment><USER4> Oh _please_. I've been using C99 for almost 5 years now.

<comment><USER25> I would never go back. And the amount of campaigning I did at my last job to use C++11 was because all the new language features to allow compile-time checking helped us not do dumb things at run-time.

Except for the stupid TI compiler, which is still stuck on C++03.

<comment><USER5> Or C++98, depending on the chip, if some of their docs are still up to date. :\

</comment></comment></comment></comment></comment><comment><USER26> I can't be the only one that 99.9% of the time doesn't care _one iota_ about these mythical optimizations that compilers can introduce by exploiting undefined behavior. I just want to write straightforward, predictable code that tries its best to be safe but for one reason or another have to stick with C.

Is there a guide/reference on how to disable these optimizations in modern compilers? A list of GCC/Clang arguments that disable as much of this as possible would be greatly appreciated. I've seen a lot of posts and articles discussing C undefined behavior but almost nothing describing how to counter it.

<comment><USER22> Sure. Compile at -O0.

A huge number of seemingly-trivial optimizations depend on assuming that undefined behavior will never happen. The number of optimizations that don't depend on UB _in any way_ is quite small. For example, if you want to get pedantic about it, even automatic promotion of local variables to registers is exploiting undefined behavior—who's to say you didn't have a pointer that just happened to point to one of them?

<comment><USER27> Most languages have no concept of undefined behavior and they still have compilers and runtimes that can do a huge amount of optimizations.

<comment><USER28> Because they define-away the scenarios where UB is an issue for most code. Sometimes they do this by having a GC, but Rust and Swift prove that isn't necessary.

Such languages typically do provide some form of "no promises, here there be dragons" in the form of unsafe blocks or functions. Restricting this region of unsafety is a huge benefit for programmers and compilers. Programmers because relatively few pieces of code need to be carefully reviewed. Compilers because most of the program contains little or no UB.

As a typical example, in C you can alias and type pun. Therefore to avoid all UB the compiler would need to be extremely careful in any function containing a pointer. You could return a reference to a local through a separate opaque function call, or receive multiple pointers all aliasing the same memory. To completely avoid all UB means inserting checks after every potentially mutable machine instruction, or emitting duplicate function bodies that take different paths when the pointers alias; that's assuming the compiler even has enough type information to answer the question!

With typical C#, Rust, Swift, etc you just can't cause those kinds of problems without deliberate subterfuge and use of Unsafe types or blocks.

<comment><USER29> Note that `unsafe` code blocks (or having some unsafe primitives) fundamentally results in some kind of UB in the language as a whole, and you _totally_ can create tons of problems from it, since the rest of the language has invariants it can't _itself_ violate, but the unsafe code can (potentially much easier than C, if there are more invariants) - that is the "UB", and the invariants that can be violated are what the compiler optimizes based on.

Lest we forget, _any_ language with a C FFI capability must have some notion of UB, because the FFI _effectively includes_ the C code in its own semantics (unless fully sandboxed, which may be too expensive to be done).

<comment><USER5> True, but they are quite easy to track down.

In systems like Unisys ClearPath, you can even configure the system such that only admins can execute applications with unsafe blocks.

In C any line of code, if care is not taken to use the correct compiler flags, can be a possible source of UB.

<comment><USER30> > In C any line of code, if care is not taken to use the correct compiler > flags, can be a possible source of UB.

What do you mean?

<comment><USER5> You need to turn on all warnings as errors, static analysers and pedantic modes depending how each compiler allows them.

ANSI C11 has 200 documented cases of UB, and each compiler might have additional cases, are you sure you can know all of them by heart while looking at a random line of C code?

</comment></comment></comment></comment></comment></comment></comment></comment><comment> Paul-ish How much of the UB in C is carried over to C++? Does the C++ standards committee carry a lot of the UB over into C++, or try to fix the issue? If C++ doesn't have the same UB, maybe the solution is to compile C code with a C++ compiler.

<comment><USER31> The intent of C++ is that the subset that is valid C code ends up being largely semantically identical in C++ and C. There are some differences, particularly related to the type system (for example, in C, a ternary expression is an rvalue, where it can be an lvalue expression in C++). Most, perhaps all, of the undefined behavior is retained C++.

There is potentially a case where C eliminated undefined behavior that C++ retained--the "union trick" for getting access to the bits of a float was made legal in C99 but the C++ language (modified to support unrestricted unions) suggests that it is undefined behavior in C++.

</comment></comment><comment><USER32> Strict aliasing needs to go out the window. That's for starters.

<comment><USER33> That may be. It sure is broken. What they did:

Things of similar base type (so ignoring "signed", "const", etc.) may alias. Everything may alias with "char".

What would make more sense:

Any unsigned integer type may alias with any type of the same size; this is not transitive. (so a floating-point type may not alias with a pointer type, but there likely are unsigned integer types that may alias with both) Structs may alias other structs from the beginning until the point at which the types of their content diverge.

Even with that better default, you'd still want easy ways to override it in both directions.

</comment></comment><comment><USER34> Naive question:

Are there any compiler optimizations that -Ox makes possible which couldn't have been written originally as readable C code?

<comment><USER19> For sure.

Consider idiom recognition, where a compiler takes a series of operations that implement some operation that isn't expressible as a language primitive and turns it into a single machine instruction that performs that operation. Rotate built up from a couple of shifts for example.

Consider auto-vectorization for which the language has no direct support.

Consider inlining and value-propagation and all the simplification can that occur when you combine them.

Basically compile any non-trivial C program without optimization (or without some interesting optimization option) and with optimization, and look at the assembly. In many cases you wouldn't be able to write C code at all to reproduce the optimized version with the not-optimizing compiler. In other cases you could, but at the cost of code duplication or other things that would reduce the quality of your code.

</comment></comment><comment><USER35> I didn't know the C std was still being modified/enhanced. Interesting. Does sound scary.

<comment><USER24> It hasn't been updated in any meaningful sense beyond C89, though.

<comment><USER5> C'mon it even has some kind of primitive generics support nowadays, which other modern languages keep ignoring.

<comment><USER36> C11 generic selection is basically not worth using and almost worse than not having "generics" at all. It exists so tgmath.h can be written without implementation magic but tgmath.h is kind of a garbage fire itself.

</comment></comment></comment></comment><comment><USER32> Faintly?!

</comment><comment><USER37> We need a -Osafe flag.

</comment><comment><USER38> [https://github.com/ziglang/zig](https://github.com/ziglang/zig) and Jonathan Blow's JAI language seem to be contenders for C replacement.

<comment><USER39> Arguably the Rust language is a replacement candidate for 'C' (and C++).

<comment><USER40> I'm studying Rust, though wouldn't claim I know it yet. I believe Rust is an effort to create a language in which you can write code that's as fast and portable as C; and yet, for which, the compiler can help you coordinate a "single owner permitted to write" strategy for thread safety -- at the expense of increased bother and fuss coaxing your program into that pattern. I wouldn't call it a C replacement; while I'm glad to have Rust available, I prefer concurrency (when I need it at all) via processes, rather than threads, with no shared memory.

<comment><USER41> > while I'm glad to have Rust available, I prefer concurrency (when I need it > at all) via processes, rather than threads, with no shared memory.

Are you implying that Rust can't do multi-processing through processes?

<comment><USER40> I don't know yet.

I've heard about at least two languages that adore threads, and have issues with multi-processing. Perl6 has threads in its runtime helping its GC --- and calling fork kills its programs. I don't know yet if rust has threads _required_ in a fashion that makes it crash if you try to fork().

perl6 cannot fork; and golang behaves badly if you fork in a program that uses goroutines. Ends up unhappy, since shared library manipulation is kinda dependent on the process loader. Oops.

I'm tempted to hope that the Rust lang devs have kept use of threads out of its required runtime. To answer your question, I didn't mean to imply that rust cannot call fork(2), and I hope it isn't true. I meant to say that I wouldn't call Rust a C replacement; it's an effort to solve a problem (threads with shared heap or stack) that C flat doesn't attempt to consider. I love C, and feel obliged to learn Rust.

<comment><USER42> Rust has no more runtime than c. Threads are implemented in the standard library, but they'll only be used if you explicitly create one (or a library you are using does). Fork works fine :)

Rust has a very different design philosphy to c, and in that respect you are right that it isn't a complete replacement. That said, Rust is good for far more than just multithreading. It solves memory safety as well as tgread safety.

<comment><USER43> > Fork works fine.

It _can_ work but it's quite unsafe. The standard library doesn't make any guarantees about fork safety. The language itself doesn't understand what fork is, and so can't guarantee anything.

</comment></comment></comment></comment></comment></comment></comment><comment><USER44> Wow... I remember a simple, elegant language. The C, I knew had close to a 1-1 mapping to assembly. The compiler didn't overthink things.

How can you muck this up!

I thought it was C++'s job to turn something simple/elegant into an indecipherable mess!</comment>


Why TDD: Freedom to refactor - <AUTHOR> http://www.malethan.com/article/why_tdd_freedom_to_refactor.html <comment><USER2> Note that nothing in this article was actually dependent upon TDD; writing unit tests after writing code, and keeping your code clean/refactored would suffice.

<comment><AUTHOR> The point I was trying (and I think succeeded) to make is that by employing TDD you automatically have more test coverage and therefore make refactoring and keeping your code clean that much easier.</comment></comment>


Ask HN: Who's going to Work At A Startup 2012 - <AUTHOR>

If you got into Work At A Startup 2012 post about which companies you're most interested in learning about or meeting. <comment><USER2> I just moved down here last week and am excited to check it out.

</comment><comment><USER3> Airbnb, Codecademy, Dropbox, and Mixpanel.</comment>


Here's our pick of the 10 hottest West Coast startups in 2013 - <AUTHOR> http://thenextweb.com/insider/2013/01/04/west-coast-startups-to-look-out-for-in-2013/?fromcat=all

<comment><USER2> When does the east coast list come out?</comment>


10 Books that will Substitute A Computer Science Degree (debate?) - <AUTHOR> http://www.techoozie.com/10-books-that-will-substitute-a-computer-science-degree/

<comment><USER2> ... and here are my 10 Lego sets that will substitute an Engineering Degree!

Degrees are not just about the literal content. They are three/four/five/ years of intense experience in a play pen where highly skilled people correct your every move and thoughts guiding you toward a greater understanding.

<comment><USER3> I agree with your sentiment, however I note that the element of "intense experience in a play pen where highly skilled people correct your every move and thoughts guiding you toward a greater understanding" is very, very institution, department, and professor-dependent.

<comment><USER4> In my experience, it's more peer-dependent. In practice, I barely interact professors, TAs, or "the department". All of my [school] learning has been through grinding through psets, projects, or intellectual discussions with friends.

<comment><USER3> Fair enough. But I think we're in violent agreement on this: A degree problem can be a lot more than what's between the covers of the books, but that is not always the case.

</comment></comment></comment></comment><comment><USER5> Strange list. Some great stuff on there, but if I were going to attempt to substitute for an undergrad CS degree, I'd definitely have SICP on a list ahead of APL, for example.

Of course, the whole topic is quite silly; if you really wanted to substitute for a CS degree, the easiest way to do it would be to examine (for example) the MIT course catalog, put together the appropriate course plan, and then order the textbooks used by those courses. And, with the video lectures and lecture notes showing up on OCW, you would actually be approximating (in a loose sense) the experience, provided one actually does the coursework and exams.

</comment><comment><USER6> Nah come on, in the years it takes to get a CS degree, hopefully you'll touch on more subjects than these. You'll also do several projects.

Also Godel, Escher, Bach is really more a popular science book, isn't it? Enjoyable read that it was (when I was a teenager), I think it is actually more confusing than actually helpful in understanding the underlying concepts.

</comment><comment><USER7> That title makes a lofty claim and does not really deliver. The books they chose are not flawed, but in terms of ordering them and limiting them to 10, some is left to be desired. Here are some I would add:

Design Patterns: Elements of Reusable Object-Oriented Software

Introduction to Algorithms

<comment><USER8> Too bad we don't live in a culture with base 12 numbers.

</comment></comment><comment><USER4> They're missing discrete math, probability, linear algebra, networks, security, distributed systems, user interface design, interacting with other computer scientists, and the labor of intensive problem sets and projects. And, oh yeah, any practical experience building anything whatsoever.

<comment><USER9> And not to mention shared-memory parallelism. Multicore anyone? Ever heard of it?

Going the 10-books-will-do-route will also make sure that you won't get exposed to specialized fields such as embedded and real-time systems, machine learning, computational geometry, bio informatics, etc.

A degree is also about knowing that certain fields exist; you don't necessarily need to have studied everything. You can read up on them when you need specialized knowledge, but if you've never heard of some obscure field because your "ten books" didn't mention it, then you are screwed.

At a good university you will be exposed to a much wider variety of topics than any (reasonably sized) set of books will do.

</comment></comment><comment><USER10> My first love <http://isbn.nu/9780070260016>

</comment><comment><USER11> 10 Books + a lot of practical experience. :)</comment>


Ask HN: Gmail is down. Or is just me? - <AUTHOR>

Can't access Gmail from Belgium. This is the message I get:

  Temporary Error (500)

  We're sorry, but your Gmail account is temporarily
  unavailable. We apologize for the inconvenience and
  suggest trying again in a few minutes.

  If the issue persists, please visit the
  [Gmail Help Center »]

  [Try Again] [Sign Out]

  [Show Detailed Technical Info]
  Numeric Code: 93
 Any news about it? <comment><USER2> There are reports of a partial outage which is ongoing:

[http://www.google.com/appsstatus#hl=en&v=issue&ts=13...](http://www.google.com/appsstatus#hl=en&v=issue&ts=1334703599000&iid=a88855ea3653b5d2f71d98b0b8906f84)

</comment><comment><USER3> It's working again for me..

this made me think how much dependent to Gmail I am...

</comment><comment><USER4> yep, same here. Error:93

[http://groups.google.com/a/googleproductforums.com/forum/#!c...](http://groups.google.com/a/googleproductforums.com/forum/#!categories/gmail/report- an-issue)

</comment><comment><USER5> <http://www.downforeveryoneorjustme.com/gmail.com>

<comment><AUTHOR> This is not what I meant.

</comment></comment><comment><USER6> It's trending on twitter, seems to be pretty widespread.</comment>


HexLox – Protect Your Saddle and Wheels from Theft 50% in 20hrs - <AUTHOR> https://www.kickstarter.com/projects/hexlox/hexlox-anti-theft-for-saddles-wheels-and-more-made <comment><AUTHOR> 80% now.</comment>


Ireland became a back door to Britain – The Spectator - <AUTHOR> https://www.spectator.co.uk/2019/04/how-ireland-became-a-back-door-to-britain/ <comment><USER2> Keeping the border between the Republic of Ireland, Northern Ireland, and the UK open is a very, very, big deal because it's a component of [https://en.wikipedia.org/wiki/Good_Friday_Agreement](https://en.wikipedia.org/wiki/Good_Friday_Agreement) and not having car bombings and assassinations is a good thing.

</comment><comment><USER3> Maybe it's time for the really interesting referendum - the one that asks if we want the UK to exist as it does now going forward?

Pick your future from:

\- As-Is

\- All on their own (complete dissolution)

\- England, Wales and Scotland remain, NI out

\- England, Wales and NI remain, Scotland out

\- England, Scotland and NI remain, Wales out

\- NI, Wales and Scotland remain, England out

\- England and Wales as one group, Scotland and NI as another

etc.

I genuinely believe that the ageing, flag-waving rule Britannia types would be surprised by the outcome.

Would the Scottish referendum have been different if they asked all other regions "Do you want to keep the Scottish?"

After all, what's the point in a political union when several parts of it want to break away and remain in a different political union?

</comment><comment><USER4> Classic problem with single line of "defense" thinking. That defense has to be perfect.

Same problem in US with thinking that a border wall will help when most undocumented immigrants are visa overstays.

</comment><comment><USER5> If it's that bad of a problem just move the borders back to England where they were to begin with.

<comment><USER6> I might be wrong but I don't think Ireland has ever been ruled by a single government.

<comment><USER5> I might be wrong but I don't remember anyone asking England to invade.</comment></comment></comment>