Hi,
I've been seeing this operator ($) a lot in different sources. What does it do? I searched google and wiki but didn't find any info about it.
Hi,
I've been seeing this operator ($) a lot in different sources. What does it do? I searched google and wiki but didn't find any info about it.
I've never seen an operator $ - there are some compiler extensions to support $ as part of the identifiers e.g. you could have a symbol my$var - a bit like _ in that sense.
Edit: are you perhaps referring to the $ used in shell-scripts and PHP to indicate a variable? e.gin php.Code:$foo=7;
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
This is one of the places where I saw it:
I understand the part where he compiles, but I don't understand the one on the first line.Code:$ cat foo.c #include <stdio.h> struct empty { }; int main ( ) { printf( "%ld\n", sizeof(empty) ); return 0; } $ gcc foo.c foo.c: In function `main': foo.c:5: error: `empty' undeclared (first use in this function) foo.c:5: error: (Each undeclared identifier is reported only once foo.c:5: error: for each function it appears in.) $ g++ foo.c $ ./a.exe 1
Thanks anyway.
Last edited by Abda92; 11-20-2007 at 10:15 AM.
Oh, that is not actually part of the code. It is just the shell prompt.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
That's like the "C:\>" in a Windows/DOS command shell.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
ooooh, OK. Thanks. I've never seen "cat" being used in the shell.
Nowhere. I didn't even know it exists! I've used linux for a while, but I never needed it. What does it do?
Concatenate files together and print them to the command line (or wherever you redirect the output to). Since there is only one file specified, it just prints that file's content.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Good thing the guy that made the example wasn't running as root, otherwise you'd be trying to find a #cat preprocessor directive!
"cat" is equivalent to "type" in a DOS box (but can do a lot more)
Todd