Earlier quoted context omitted.
Distinction without a difference. If you can't explain to your students why the words out of your mouth are useful, you've already lost them. The fact of the matter is that you're getting hung up on implementation details that do nothing to explain the concept. Pointer arithmetic, how pointers interact with the type system... those are important, but they're completely incidental. There's no fundamental reason C had…
That C pointers have a type which is used for checking, semantics of memory access and arithmetic falls into a category that I like to call requirements , whereas I use the word implementation detail for something like how many bits are in a pointer, and do pointers to bytes have the same representation as pointers to wider types. (These are also requirements, but ones an implementation can vary.) I accept your termi…
Pointers in C (2010)
101–110 of 113 posts
Re: Pointers in C (2010)
#102Earlier quoted context omitted.
> C pointers being typed is absolutely central. No it isn't. The rest of your post shows why. > Firstly, because a pointer is typed, when we dereference it Nonsensical and circular. > Secondly, arithmetic on pointers... Nonsensical and circular. > Thirdly, we get error checking: there is a good amount of resistance in the language against mixing up types. If we convert one type of pointer... Circular. Every single on…
Please don't post in the flamewar style to HN. It leads to increasing nastiness, as happened below, and you did quite a bit to fuel that. If you'd please review https://news.ycombinator.com/newsguidelines.html and take the spirit of this site to heart, we'd be grateful. We don't want threads to go up in flames.
Explaining what a pointer is by using the term "pointer" and explaining how to use one is a circular definition. A student who has never heard the term "pointer" before is going to be completely lost if the instructor jumps straight to "Pointer arithmetic works by increments of the size of the type of object to which the pointer points." If that is the first statement someone is exposed to, it will not make sense to them. I understand that someone may not like their proposal being called circular, but I don't think it's unfair or bad behavior to point it out.
The linked-to article is well done. There are some minor errors, as have been pointed out elsewhere. However, I think the criticism in this thread of conversation is deeply negative in a hostile, nasty way.
Re: Pointers in C (2010)
#103Earlier quoted context omitted.
Please don't post in the flamewar style to HN. It leads to increasing nastiness, as happened below, and you did quite a bit to fuel that. If you'd please review https://news.ycombinator.com/newsguidelines.html and take the spirit of this site to heart, we'd be grateful. We don't want threads to go up in flames.
I'm sorry, but I disagree. The very first sentence of the linked article is being criticized unfairly. People are claiming that the very first sentence is incomplete because it should explain pointer arithmetic and typing. Explaining what a pointer is by using the term "pointer" and explaining how to use one is a circular definition. A student who has never heard the term "pointer" before is going to be completely lo…
> Nonsensical and circular.
> Nonsensical and circular.
> Circular.
> You all can downvote me all you want, but you're still objectively wrong.
If you feel that something is being criticized unfairly, you will win more people over to your point of view with civil and respectful conversation instead of flamebait.
We can have different opinions about something and still have an enjoyable conversation and learn from each other, as long as we interpret each other charitably and have a sense of humor about it.
Fair enough?
Re: Pointers in C (2010)
#104Earlier quoted context omitted.
Interesting. In C, “&array[0]“ is the same thing as “(array + 0)”, but in my copy of the C11 draft standard, I can't find anything about adding zero to a null pointer.
"&array[0]" is equivalent to "&(array[0])" - [] has greater precedence than &. Desugared, this is "&(*(array + 0))" - add 0, dereference, then take the address.
Re: Pointers in C (2010)
#105Earlier quoted context omitted.
I'm sorry, but I disagree. The very first sentence of the linked article is being criticized unfairly. People are claiming that the very first sentence is incomplete because it should explain pointer arithmetic and typing. Explaining what a pointer is by using the term "pointer" and explaining how to use one is a circular definition. A student who has never heard the term "pointer" before is going to be completely lo…
Dan's request wasn't about the technical merit of your comments, it was about the style: > Nonsensical and circular. > Nonsensical and circular. > Circular. > You all can downvote me all you want, but you're still objectively wrong. If you feel that something is being criticized unfairly, you will win more people over to your point of view with civil and respectful conversation instead of flamebait. We can have diffe…
If you'd like to discuss further, my email is my username at GMail dot com. Otherwise, I'm going to let this lie.
Re: Pointers in C (2010)
#106Earlier quoted context omitted.
You believe correctly, but naturally, it's a lot more verbose: var lowercaseIds = ids.stream().map(String::toLowerCase); and an additional .collect(Collectors.toList()) if you don't want a Stream instance. (var is Java 10, though I believe it should not be used in production code, ever)
> var is Java 10, though I believe it should not be used in production code, ever Is that your opinion of var in general, or something about Java's implementation of it? If the former, I'm really curious why, as a C# dev who's used it for many years.
Sometimes I explore source code on GitHub, excessive use of var makes reading it very uncomfortable.
Turning it around, what are the benefits of var? Slightly increased typing speed. More time is spent reading source code than writing it and var makes reading harder and writing easier, so it's not worth the trade in my opinion.
Re: Pointers in C (2010)
#107Earlier quoted context omitted.
> var is Java 10, though I believe it should not be used in production code, ever Is that your opinion of var in general, or something about Java's implementation of it? If the former, I'm really curious why, as a C# dev who's used it for many years.
I'm not a java dev, and I don't anything around introduction var into java. But I am a c# dev, and in the early days when var was introduced a lot of people avoided var because of misunderstanding of how it works. People thought it was dynamic rather than inferred, is it the same here?
See my reason for not using it above.
As someone who holds no mastery over C#: Is it appropriate to ever use dynamic anywhere besides horrifying interop code?
Re: Pointers in C (2010)
#108Earlier quoted context omitted.
> var is Java 10, though I believe it should not be used in production code, ever Is that your opinion of var in general, or something about Java's implementation of it? If the former, I'm really curious why, as a C# dev who's used it for many years.
Unless you are using a constructor to fill the var, it makes reading/exploring/understanding source code more difficult. If the value comes from a method, enjoy chasing it down in your VCS. In your IDE you only need to hover it, but it's still an unnecessary extra step. Sometimes I explore source code on GitHub, excessive use of var makes reading it very uncomfortable. Turning it around, what are the benefits of var?…
Re: Pointers in C (2010)
#109Earlier quoted context omitted.
> C pointers being typed is absolutely central. No it isn't. The rest of your post shows why. > Firstly, because a pointer is typed, when we dereference it Nonsensical and circular. > Secondly, arithmetic on pointers... Nonsensical and circular. > Thirdly, we get error checking: there is a good amount of resistance in the language against mixing up types. If we convert one type of pointer... Circular. Every single on…
Please don't post in the flamewar style to HN. It leads to increasing nastiness, as happened below, and you did quite a bit to fuel that. If you'd please review https://news.ycombinator.com/newsguidelines.html and take the spirit of this site to heart, we'd be grateful. We don't want threads to go up in flames.
Re: Pointers in C (2010)
#110Earlier quoted context omitted.
> Every single one of your points ... presupposes that the reader knows what a pointer is and how it works. Pardon my mistake; I made these points under the belief that I'm in a debate about how to teach pointers to a beginner audience, not that I'm addressing that audience itself.
Come on, please don't be a jerk on HN.