K
Keith Thompson
Tom St Denis said:You talk funny.
No, he writes amusingly.
Tom St Denis said:You talk funny.
Richard Heathfield posted:
#include <stdio.h>
onkar said:Why use pointers at all??
Ancient_Hacker said:Well, in C, it's hard to impossible to do certain things without
resorting to pointers.
If you can get by with arrays and structs and arrays of structs,
then go ahead.
August said:.... snip ...
Raw pointers must be used with great care. With them we can for
instance write a function that returns a pointer to the stack:
int *f(void)
{
int t;
return &t;
}
This is not possible in a language with (only) restricted pointers.
Better than speaking poorly.Tom said:You talk funny.
Why use pointers at all??
Frederick said:.... snip ...
Your compiler is non-conforming if it refuses to compile the
following program:
#include <iostream>
int *Func()
{
int t;
return &t;
}
int main()
{
int i; std::cin >> i;
if(i) Func();
}
CBFalconer said:And this is totally useless, since any dereference of the return
value of f results in undefined behaviour. All you can do with it
is compare it for equality with some other int pointer, and the
result should be false.
You still have another outstanding error that needs correcting - an
apology to Keith Thompson. Don't leave it too long.
I don't understand why such offense was taken to the word, "fascist".
[/QUOTE]Why use pointers at all??
How else would you point to things?
Frederick Gotham said:I don't understand why such offense was taken to the word, "fascist". My
intent to was to poke at you, Kieth, expressing my condemnation of your
attitude to "char unsigned". The intent was to stir you, not to downright
offend you with offensive labels (e.g. such as "son of a bitch",
"shithead", etc.). If you were highly offended by this, then you must
understand that I am at a loss to understand why.
Finally: This is an old, forgotten topic. If I were to call everyone
up on everything bad they'd ever done to me, I wouldn't have any
friends. Nor family come to think of it.
CBFalconer said:No, it is non-conforming if it compiles that collection of syntax
errors, undefined behaviour, etc.
Peter said:Conformance is generally limited to two things: issuing _at least
one_ diagnostic for constraint violations, and the correct semantic
implementation of strictly conforming programs (subject to
implementation limits.)
Code that is not strictly conforming may or may not require a
diagnostic. If it does, then a conforming compiler must issue it.
But whether such code is accepted, compiled, linked, etc... is
completely at the implementation's discretion. That is the freedom
that undefined behaviour allows.
Why use pointers at all??
onkar said:Why use pointers at all??
onkar said:Why use pointers at all??
If the arguments of a function should be modified
then the addresses of
them
should be passed into the function and the corresponding
parameters should be declared as pointers of type same as the arguments.
Then it's time for you to study a little history, bonehead.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.