Thread View: gnu.g++.help
2 messages
2 total messages
Started by Timothy Miller
Thu, 07 Mar 1996 19:52
3Q's: stdio.h, unary minus, declaration/definition
Author: Timothy Miller
Date: Thu, 07 Mar 1996 19:52
Date: Thu, 07 Mar 1996 19:52
41 lines
2458 bytes
2458 bytes
Should g++ have a stdio.h file? The installation here didn't have one, and when I complained about it, the admins completely reinstalled g++. It was STILL missing stdio.h. They told me that they FTP'd it twice and were very careful about the installation, but it just doesn't have stdio.h. I need it for things like sscanf. --- If I have a member function that overloads the unary minus operator, is the 'this' object the object that the minus is attached to, or is it a temporary copy? --- I have Stroustrup's book on C++, and his use of the terms 'declaration' and 'definition' are odd to me. I was taught that a definition is something that simply describes the structure of something, such as a function prototype, a struct description, an extern statement, or or anything that doesn't create or state an actual object but refers to an actual object somewhere else or describes what something should look like. A declaration is where an actual instance of something is given or created. An actual function, a local or global variable statement, etc. But Stroustrup seems to get them mixed up a bit. He calls an extern a declaration... but it's not declaring anything... it's simply defining what the object elsewhere looks like. He calls a statement that creates an actual variable a definition, but you're not defining it, you're declaring it to actually exist there. With a few exceptions, Stroustrup's book uses definition and declaration completely reverse of what I was taught in school and by books on programming C that I have read. Is he making a mistake or am I? --------------------------------------------------------------------------- Timothy Miller, millert@grad.csee.usf.edu Theoretical Linguistics http://www.csee.usf.edu/~millert Music Theory, Computer Engineering --------------------------------------------------------------------------- Cunning linguists are very skilled with their tongues.
Re: 3Q's: stdio.h, unary minus, declaration/definition
Author: Mike Stump
Date: Fri, 08 Mar 1996 22:20
Date: Fri, 08 Mar 1996 22:20
55 lines
2244 bytes
2244 bytes
In article <Pine.SUN.3.91.960307143932.2763A-100000@grad>,
Timothy Miller <millert@csee.usf.edu> wrote:
>
>I have Stroustrup's book on C++, and his use of the terms 'declaration'
>and 'definition' are odd to me.
>
>With a few exceptions, Stroustrup's book uses definition and
>declaration completely reverse of what I was taught in school and by
>books on programming C that I have read.
>
>Is he making a mistake or am I?
Think about the English language. A definition is meant to fully
describe the term, in the definition, one can use other terms that are
defined elsewhere. A definition is a substantial thing. (If your
dictionary if less then 4 inches thick, go find a real dictionary, and
lookup a simple work, like `a'. You will find something rather
complete, and quite long.
For example, consider:
void walk();
verses
void walk() {
while (1)
{
move_right_leg_forward ();
move_left_leg_forward ();
}
}
and
walk (verb).
verses
walk (verb): The act of repeatedly moving the right leg forward, followed by
moving the left leg forward.
and the words definition and declaration. The longer form immediatly
above seems to be a definition of the word walk. The one just prior,
just a declaration that the word walk is a verb. The later is not
considered a definition of the word walk. In this same way, the first
one above, is just a declaration of the verb, opps, I mean function
walk. It doesn't say what walk is. To know what it is, you would
have to consult a _definition_ of the work walk someplace. The
definition of walk appears just below the declaration.
Seems to make sense to me. Can you cite the books and provide quotes?
I am really curious to know if it is just you memory playing tricks on
you, or if in fact someone else uses the terms differently.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads