|
So the podcast, 99% Invisible, causes a 2016 Mazda sedan radio to crash. Because when parsing the url "% I" tells the car to run some code. They don't really go into detail on how exactly it fails sadly.
|
# ? Apr 25, 2019 06:16 |
|
|
# ? Jun 8, 2024 08:27 |
|
code:
|
# ? Apr 25, 2019 07:02 |
|
dougdrums posted:It's not ambiguous, the pointer is part of the declarator. I mean this is well worn ground and I don't think I'm telling anyone anything new but: Spoiler, the code is not sensible anyway and the C decl grammar is completely stupid.
|
# ? Apr 25, 2019 07:27 |
|
A reasonable lang would make it a syntax error to declare two variables of totally different types in the same statement.
|
# ? Apr 25, 2019 07:30 |
|
But think about the time saved, the massive performance increase and how awesome you look when there is one less line in your code.
|
# ? Apr 25, 2019 08:32 |
|
RPATDO_LAMD posted:A reasonable lang would make it a syntax error to declare two variables of totally different types in the same statement. Just don't allow declaring two variables in the same statement at all. Also using an if/else/while/etc. and not using braces should be a syntax error
|
# ? Apr 25, 2019 08:54 |
The idea is that int *x, y; declares *x to be an int, and also y to be an int. It's not "the type of x is int*", it is "the type of *x is int".
|
|
# ? Apr 25, 2019 09:43 |
|
nielsm posted:The idea is that int *x, y; declares *x to be an int, and also y to be an int. It's not "the type of x is int*", it is "the type of *x is int". Yup. "int* x" should be a syntax error. It should be either "int *x" or equivalently "&int x". Ampersand references, asterisk deferences.
|
# ? Apr 25, 2019 10:38 |
|
nielsm posted:The idea is that int *x, y; declares *x to be an int, and also y to be an int. It's not "the type of x is int*", it is "the type of *x is int". Which is all very well and good except that the actual semantics are to declare a variable x whose type is int* The way the syntax works is inexcusable, sorry
|
# ? Apr 25, 2019 11:40 |
|
nielsm posted:The idea is that int *x, y; declares *x to be an int, and also y to be an int. It's not "the type of x is int*", it is "the type of *x is int". Well then, I guess this won't assert code:
Xarn fucked around with this message at 13:02 on Apr 25, 2019 |
# ? Apr 25, 2019 13:00 |
|
Ola posted:But think about the time saved, the massive performance increase and how awesome you look when there is one less line in your code. Packing multiple declarations on to one line could save hundreds of byte of precious disk space on a large codebase! That was probably a legit concern back in the day, along with fewer keystrokes to transcribe the program from the magazine or book
|
# ? Apr 25, 2019 14:18 |
|
Munkeymon posted:Packing multiple declarations on to one line could save hundreds of byte of precious disk space on a large codebase! I am guessing the complexity of the original compiler was a bigger factor.
|
# ? Apr 25, 2019 14:30 |
|
Munkeymon posted:Packing multiple declarations on to one line could save hundreds of byte of precious disk space on a large codebase! I'm not sure if any C programs were written on punch cards, but the language was probably designed with that use case in mind.
|
# ? Apr 25, 2019 15:30 |
|
Dumb Lowtax posted:In JavaScript sometimes you make long lines with lambdas nested inside expressions. Sometimes you do a few of these in a row. Sometimes I have a few complex, but similar lines in a row* and that's when I like to add horizontal spacing to make sure the like tokens line up. That can't really be done automatically because it's a subjective choice of whether to do it or not. Aren't you the person like a year ago advocating in this thread for longer line lengths and less vertical scrolling?
|
# ? Apr 25, 2019 15:50 |
|
Thermopyle posted:Aren't you the person like a year ago advocating in this thread for longer line lengths and less vertical scrolling? You can filter a thread to only the posts from a specific person if you click the "?" button underneath their posts!
|
# ? Apr 25, 2019 15:56 |
|
Hammerite posted:You can filter a thread to only the posts from a specific person if you click the "?" button underneath their posts! It was a rhetorical question.
|
# ? Apr 25, 2019 15:57 |
|
Nude posted:So the podcast, 99% Invisible, causes a 2016 Mazda sedan radio to crash. Because when parsing the url "% I" tells the car to run some code. They don't really go into detail on how exactly it fails sadly. This was solved later on, it's the "%n" token in printf, where "%In" also does it. They were on the right track in the reply all episode but didn't test all of the tokens. There's a Reddit post for the reply all podcast from 1-2 weeks ago that solved it the rest of the way. edit: Oooh, this actually makes much \*more\* sense. T... https://www.reddit.com/r/gimlet/comments/bdxht4/hey_its_ben_from_the_reply_all_episode_140_i_have/el1hf1q
|
# ? Apr 25, 2019 17:03 |
|
Soricidus posted:Which is all very well and good except that the actual semantics are to declare a variable x whose type is int* Yeah, a derived type. It's like saying the syntax of mov rax, [rsp+4*8] is inexcusable. It makes sense to write T[] x; in higher-level languages, because x is really a reference type in those cases, with no special relation to pointer types (if said language has pointers), whereas subscription in C is sugar for pointer arithmetic. Hammerite posted:Just don't allow declaring two variables in the same statement at all. dougdrums fucked around with this message at 17:29 on Apr 25, 2019 |
# ? Apr 25, 2019 17:23 |
|
CPColin posted:Source code should only ever save to disk as an AST and IDE's should just format them into readable text on load. There was a lot of work done on structural editors in the 80s when I was studying. There was a group at my university doing that kind of research, and I had to use their ... product ... during an undergrad programming course (Modula-2 IIRC). I thought the idea was kind of neat, until I commented out a largish block of code while debugging. The editor was quite happy turning the AST into comments, but since it didn’t have an actual parser it couldn’t do the reverse.
|
# ? Apr 25, 2019 17:24 |
|
code:
e: placement of the * notwithstanding fourwood fucked around with this message at 18:17 on Apr 25, 2019 |
# ? Apr 25, 2019 18:07 |
|
Thermopyle posted:Aren't you the person like a year ago advocating in this thread for longer line lengths and less vertical scrolling? Thermopyle posted:It was a rhetorical question. I wasn't "advocating" last year, I was defending myself. There was this giant thread pile-on after I had asked if something I was doing was a horror, and explained my own mindset and internal justification for formatting that way. I was asking an earnest question and trying to learn. Don't everybody mischaracterize it to make me the thread bad guy again. I do not use long line lengths anymore since that conversation. I immediately re-formatted my hobby codebase. I hope you do not make me wear that badge forever. On the other point, less vertical scrolling, that's not fair. There is nothing inherently wrong with less vertical scrolling if it is free, or nearly free. It helps with visual memory to see things simultaneously. Fitting more content onto one screen height for free (without exceeding a density threshold, without making lines uncomfortably long, without multiple statements per line, without damaging readability such as obscuring flow control or structure, etc.) doesn't seem like it deserves guilt. For example I think the folks who just spoke up wanting strict bans on common idioms like declaring several variables, all of the same type, on the same line are taking a really extreme view. It's not a horror all the time. I think the act of intentionally avoiding being economical with space at all as part of some neverending competition for maximum readability *does* hurt readability because your code will be stretched thinner and thinner on the vertical axis until almost none of it can be seen at the same time, which is bad for visual memory and being able to keep code in your head. On that last note, here's a good source: http://paulgraham.com/head.html Happy Thread fucked around with this message at 21:57 on Apr 25, 2019 |
# ? Apr 25, 2019 18:57 |
|
You're also still putting two spaces after periods. On the internet.
|
# ? Apr 25, 2019 19:21 |
|
Red Metal posted:You're also still putting two spaces after periods. On the internet. Do something about it bitch
|
# ? Apr 25, 2019 19:36 |
|
I only use tabs after periods.
|
# ? Apr 25, 2019 19:37 |
|
Dumb Lowtax posted:For example I think the folks who just spoke up wanting strict bans on common idioms like declaring several variables, all of the same type, on the same line are taking a really extreme view. It's not a horror all the time. Dumb Lowtax posted:I think the act of intentionally avoiding being economical with space at all as part of some neverending competition for maximum readability *does* hurt readability because your code will be stretched thinner and thinner on the vertical axis until almost none of it can be seen at the same time, which is bad for visual memory and being able to keep code in your head.
|
# ? Apr 25, 2019 19:51 |
|
pokeyman posted:Love when people think it’s possible to write C without invoking undefined behaviour, if only they condescend hard enough. Yeah, this is crazy to me. Adding two ints together is potentially undefined behaviour.
|
# ? Apr 25, 2019 20:37 |
|
Doom Mathematic posted:Yeah, this is crazy to me. Adding two ints together is potentially undefined behaviour. Wait, what? Like, overflow/underflow?
|
# ? Apr 25, 2019 23:49 |
|
Signed int overflow is UB, yeah.
|
# ? Apr 26, 2019 00:02 |
|
Plorkyeran posted:Signed int overflow is UB, yeah. But unsigned is DB?
|
# ? Apr 26, 2019 02:23 |
|
Absurd Alhazred posted:But unsigned is DB? Yes, it's modular arithmetic; wraps around.
|
# ? Apr 26, 2019 02:29 |
|
Plorkyeran posted:Signed int overflow is UB, yeah. And the number of bits in an int is implementation-defined!
|
# ? Apr 26, 2019 04:17 |
|
Microsoft Excel gently caress you. it's a string. gently caress you
|
# ? Apr 26, 2019 10:03 |
|
Hammerite posted:Microsoft Excel I think you mean the cell's format is Text, OP.
|
# ? Apr 26, 2019 14:30 |
|
https://www.theregister.co.uk/2019/04/23/hertz_accenture_lawsuit/ In short, Hertz hires Accenture to revamp its online presence. $32 million later they get a codebase of poo poo.
|
# ? Apr 26, 2019 16:35 |
|
Lol at the PDF thing, I would be so happy if someone asked me for markdown or CSV instead of requiring PDF and Excel sheets
|
# ? Apr 26, 2019 16:48 |
|
I don't know if it ever got fixed, but Hertz's website would show cars available at my local place whether or not they were actually available. I would notice that they would be out of Chevy Sparks or whatever and be able to make a reservation for the next day and get it upgraded to something nice for the same price. This backfired on me once when I had to take a Jeep Renegade that looked like it was designed by a stoned jr high school student to a proposal meeting.
|
# ? Apr 26, 2019 19:59 |
|
dougdrums posted:I don't know if it ever got fixed, but Hertz's website would show cars available at my local place whether or not they were actually available. I would notice that they would be out of Chevy Sparks or whatever and be able to make a reservation for the next day and get it upgraded to something nice for the same price. This backfired on me once when I had to take a Jeep Renegade that looked like it was designed by a stoned jr high school student to a proposal meeting. I was under the impression that rental companies have always done that: you come in and you get whatever's available regardless of what you actually asked. The idea is that they want to have their cars always on the move. No way in hell they'll keep that Jeep in the parking lot sitting there for you to pick it up tomorrow. That would be a waste of money. So, whether you reserved something or you just show up out of the blue is irrelevant.
|
# ? Apr 26, 2019 20:02 |
|
Yeah it always says "Car Model or similar". I don't think I've ever got the brand it said on the menu. They have their own car classification system: https://www.sixt.co.uk/faqs/acriss-code/ Why then, do they keep on advertising specific brands? Probably a focus group thing. Their web sites have always been dumpster fires. It wouldn't surprise me if byzantine legacy issues made the upgrade project go to poo poo. Anyway, I too get upgrades often by playing with that classification system. They have many different classes, but my local station won't have all of them. So I just pick the one that's slightly more than the cheapest (because they definitely have those), I think it's ILAR. When they don't have that, I get whatever they have available better than that, which can be a very nice car. No Golf automatics in, so I get a fully decked out Volvo S90 instead? Don't mind if I do!
|
# ? Apr 26, 2019 20:13 |
|
Ah, well I thought I was being clever. Lord knows nobody else over the age of 25 was going to willingly rent that monstrosity. I'd get Buicks and Chryslers for the price of a subcompact which was always pretty swanky. I think my place is just small enough that it ends up being the next step from garbage tier car. It does make sense that they'd rather have someone pay half-price and be pleasantly surprised instead of letting it sit in the lot.
|
# ? Apr 26, 2019 20:27 |
|
|
# ? Jun 8, 2024 08:27 |
|
Nude posted:So the podcast, 99% Invisible, causes a 2016 Mazda sedan radio to crash. Because when parsing the url "% I" tells the car to run some code. They don't really go into detail on how exactly it fails sadly. First time I read this I thought it said it causes the car to crash
|
# ? Apr 26, 2019 20:46 |