5 ms·
> If dereferencing would have been made implicit You're misunderstanding the comment. They aren't asking for implicit derefs. They're asking for explicit deref
by dataflow 3y ago
> If dereferencing would have been made implicit
You're misunderstanding the comment. They aren't asking for implicit derefs. They're asking for explicit derefs, using * or . instead of * or ->
- psd1 3y agoYour and GP's make no sense unless the reader knows that * is a markdown directive and infers where you typed them. Which is ironic when discussing overloading!
- dataflow 3y agoIn confused, where in my comment does the Markdown syntax come into play? You're not seeing italics or backslashes are you?
- psd1 3y agoI see now - Hacki renders italics, but the browser doesn't. Excuse my confusion, this possibility didn't occur to me.
- fanf2 3y agoHacker News does not use Markdown.
- masklinn 3y agoWhile that’s technically true, it does use a severely cut down version thereof which is worse in every way: it only supports paragraphs, code blocks, and emphasis so the ability to format is extremely limited but the emphasis can still screw you over, which requires an explicit preview (or posting) to notice. And I think escaping emphasis was only introduced somewhat recently? I do remember that for the longest time you basically had to trick HN into not breaking your comments by using a different character in stead.
- OJFord 3y agoNo, but it does use: * for italics, which sometimes causes a comment to go haywire because someone uses it to reference a footnote or otherwise drops it in mid-sentence, with a matching closing one, not intending italics. (Up-thread I think it probably was like that when they commented, but has since been fixed.)
- adrian_b 3y agoWith explicit derefs, if "*x.y" is taken to mean "(*x).y", then which is the meaning of "****x1.x2[7].x3.x4[9].x5"? > "a.b" should be enough for pointers as well, I have interpreted this to mean implicit deref, as there is no "*" (could be a formatting problem).
- dataflow 3y agoI think you're still misunderstanding the proposal. What are the types of your variables? This discussion makes no sense without type information. We're defining the meaning of . for pointers here. You seem to be misunderstanding the proposal as being purely a textual transformation that ignores types? The proposal is literally: "If you see . and the left operand is a pointer, pretend the . was -> instead, because otherwise the code is already invalid."
- adrian_b 3y agoOK, I believe that you are right and if implicit dereferencing had been done only when this is the only interpretation that leads to a valid expression, then "->" would not have been necessary. However, I assume that this would have been a too complex solution for compilers that had to work in a few tens of kilobytes of memory, while a postfix "*", as already used a decade before C, would have been a trivial solution.
- masklinn 3y ago> However, I assume that this would have been a too complex solution for compilers that had to work in a few tens of kilobytes of memory It's literally the same complexity as the type checking compilers already do to tell you that your `.` does not work because the LHS is a pointer not a struct.
- adrian_b 3y agoIt is not the same complexity, because syntax checking stops immediately at an error. To determine if implicit dereferencing may be applied, more analysis has to be done, because there it may be not only a pointer to a structure, but a pointer to a pointer to a structure and so on, so multiple implicit dereferencing may be needed to obtain a valid expression. However I agree that the difference in complexity is not big.