Why is gcc not showing a warning message for using $ in a variable name?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm new to C and am learning C from Programming in C, 4th ed. by Stephen Kochan. On page 29, he writes $
is not a valid character for variable names. He is using the C11 standard.
I wrote the following code
#include <stdio.h>
int main (void)
{
int a$ = 1;
printf ("%i", a$);
return 0;
}
and ran it with the command gcc -std=c11 -pedantic practice.c -o practice.o && ./practice.o
. My filename is practice.c
.
The output is 1
. Shouldn't the compiler give me a warning for using $
? Isn't using $
sign for identifiers an extension that GCC provides?
I'm using GCC 8.2.0 in Ubuntu 18.10.
Edit:
Also, doesn't GCC not use the GNU extensions when I use -std=c11
? That is what is written in the Appendix of the book (pg. no. 497).
I am getting an warning by using -std=c89
though.
c gcc gcc-warning
|
show 6 more comments
I'm new to C and am learning C from Programming in C, 4th ed. by Stephen Kochan. On page 29, he writes $
is not a valid character for variable names. He is using the C11 standard.
I wrote the following code
#include <stdio.h>
int main (void)
{
int a$ = 1;
printf ("%i", a$);
return 0;
}
and ran it with the command gcc -std=c11 -pedantic practice.c -o practice.o && ./practice.o
. My filename is practice.c
.
The output is 1
. Shouldn't the compiler give me a warning for using $
? Isn't using $
sign for identifiers an extension that GCC provides?
I'm using GCC 8.2.0 in Ubuntu 18.10.
Edit:
Also, doesn't GCC not use the GNU extensions when I use -std=c11
? That is what is written in the Appendix of the book (pg. no. 497).
I am getting an warning by using -std=c89
though.
c gcc gcc-warning
8
Unrelated, but the.o
extension is usually used for object files, not for the final executable.
– Federico klez Culloca
Mar 10 at 11:23
3
There's no extension for executables in *nix systems. The filesystem doesn't use that to determine the type of a file. So usually executables just don't have extensions andpractice
is correct. Check your/usr/bin
directory and you'll see that the programs there don't have an extension either.
– Federico klez Culloca
Mar 10 at 11:37
2
About the fact that its properties say "shared library" is probably because of your desktop environment. If I dofile practice
from the command line I getpractice: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=928002f23b27d5c9bc55a15bf769edfaf3e62c23, not stripped
– Federico klez Culloca
Mar 10 at 11:40
1
Thefile
utility can showshared object
for an ELF executable if it is a position-independent executable. Some distributions configure GCC so that it creates position-independent executables by default (usually this requires using-pie
and-fPIC
options).
– Sergey Vlasov
Mar 10 at 15:06
1
@MrLister: Although traditional BASIC implementations used $ as a suffix for string-variable names, I wouldn't expect a trailing $ to have similar meanings in C. If I was examining code that used such a suffix, I'd expect that the programmer was exploiting some special way that the target implementation would process identifiers with such a suffix. For example, a compiler targeting a platform which can access objects near the frame pointer faster than those which are further away might place all objects whose names have a trailing$
after those that don't.
– supercat
Mar 10 at 17:41
|
show 6 more comments
I'm new to C and am learning C from Programming in C, 4th ed. by Stephen Kochan. On page 29, he writes $
is not a valid character for variable names. He is using the C11 standard.
I wrote the following code
#include <stdio.h>
int main (void)
{
int a$ = 1;
printf ("%i", a$);
return 0;
}
and ran it with the command gcc -std=c11 -pedantic practice.c -o practice.o && ./practice.o
. My filename is practice.c
.
The output is 1
. Shouldn't the compiler give me a warning for using $
? Isn't using $
sign for identifiers an extension that GCC provides?
I'm using GCC 8.2.0 in Ubuntu 18.10.
Edit:
Also, doesn't GCC not use the GNU extensions when I use -std=c11
? That is what is written in the Appendix of the book (pg. no. 497).
I am getting an warning by using -std=c89
though.
c gcc gcc-warning
I'm new to C and am learning C from Programming in C, 4th ed. by Stephen Kochan. On page 29, he writes $
is not a valid character for variable names. He is using the C11 standard.
I wrote the following code
#include <stdio.h>
int main (void)
{
int a$ = 1;
printf ("%i", a$);
return 0;
}
and ran it with the command gcc -std=c11 -pedantic practice.c -o practice.o && ./practice.o
. My filename is practice.c
.
The output is 1
. Shouldn't the compiler give me a warning for using $
? Isn't using $
sign for identifiers an extension that GCC provides?
I'm using GCC 8.2.0 in Ubuntu 18.10.
Edit:
Also, doesn't GCC not use the GNU extensions when I use -std=c11
? That is what is written in the Appendix of the book (pg. no. 497).
I am getting an warning by using -std=c89
though.
c gcc gcc-warning
c gcc gcc-warning
edited Mar 10 at 11:52
Apoorv Potnis
asked Mar 10 at 11:05
Apoorv PotnisApoorv Potnis
1638
1638
8
Unrelated, but the.o
extension is usually used for object files, not for the final executable.
– Federico klez Culloca
Mar 10 at 11:23
3
There's no extension for executables in *nix systems. The filesystem doesn't use that to determine the type of a file. So usually executables just don't have extensions andpractice
is correct. Check your/usr/bin
directory and you'll see that the programs there don't have an extension either.
– Federico klez Culloca
Mar 10 at 11:37
2
About the fact that its properties say "shared library" is probably because of your desktop environment. If I dofile practice
from the command line I getpractice: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=928002f23b27d5c9bc55a15bf769edfaf3e62c23, not stripped
– Federico klez Culloca
Mar 10 at 11:40
1
Thefile
utility can showshared object
for an ELF executable if it is a position-independent executable. Some distributions configure GCC so that it creates position-independent executables by default (usually this requires using-pie
and-fPIC
options).
– Sergey Vlasov
Mar 10 at 15:06
1
@MrLister: Although traditional BASIC implementations used $ as a suffix for string-variable names, I wouldn't expect a trailing $ to have similar meanings in C. If I was examining code that used such a suffix, I'd expect that the programmer was exploiting some special way that the target implementation would process identifiers with such a suffix. For example, a compiler targeting a platform which can access objects near the frame pointer faster than those which are further away might place all objects whose names have a trailing$
after those that don't.
– supercat
Mar 10 at 17:41
|
show 6 more comments
8
Unrelated, but the.o
extension is usually used for object files, not for the final executable.
– Federico klez Culloca
Mar 10 at 11:23
3
There's no extension for executables in *nix systems. The filesystem doesn't use that to determine the type of a file. So usually executables just don't have extensions andpractice
is correct. Check your/usr/bin
directory and you'll see that the programs there don't have an extension either.
– Federico klez Culloca
Mar 10 at 11:37
2
About the fact that its properties say "shared library" is probably because of your desktop environment. If I dofile practice
from the command line I getpractice: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=928002f23b27d5c9bc55a15bf769edfaf3e62c23, not stripped
– Federico klez Culloca
Mar 10 at 11:40
1
Thefile
utility can showshared object
for an ELF executable if it is a position-independent executable. Some distributions configure GCC so that it creates position-independent executables by default (usually this requires using-pie
and-fPIC
options).
– Sergey Vlasov
Mar 10 at 15:06
1
@MrLister: Although traditional BASIC implementations used $ as a suffix for string-variable names, I wouldn't expect a trailing $ to have similar meanings in C. If I was examining code that used such a suffix, I'd expect that the programmer was exploiting some special way that the target implementation would process identifiers with such a suffix. For example, a compiler targeting a platform which can access objects near the frame pointer faster than those which are further away might place all objects whose names have a trailing$
after those that don't.
– supercat
Mar 10 at 17:41
8
8
Unrelated, but the
.o
extension is usually used for object files, not for the final executable.– Federico klez Culloca
Mar 10 at 11:23
Unrelated, but the
.o
extension is usually used for object files, not for the final executable.– Federico klez Culloca
Mar 10 at 11:23
3
3
There's no extension for executables in *nix systems. The filesystem doesn't use that to determine the type of a file. So usually executables just don't have extensions and
practice
is correct. Check your /usr/bin
directory and you'll see that the programs there don't have an extension either.– Federico klez Culloca
Mar 10 at 11:37
There's no extension for executables in *nix systems. The filesystem doesn't use that to determine the type of a file. So usually executables just don't have extensions and
practice
is correct. Check your /usr/bin
directory and you'll see that the programs there don't have an extension either.– Federico klez Culloca
Mar 10 at 11:37
2
2
About the fact that its properties say "shared library" is probably because of your desktop environment. If I do
file practice
from the command line I get practice: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=928002f23b27d5c9bc55a15bf769edfaf3e62c23, not stripped
– Federico klez Culloca
Mar 10 at 11:40
About the fact that its properties say "shared library" is probably because of your desktop environment. If I do
file practice
from the command line I get practice: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=928002f23b27d5c9bc55a15bf769edfaf3e62c23, not stripped
– Federico klez Culloca
Mar 10 at 11:40
1
1
The
file
utility can show shared object
for an ELF executable if it is a position-independent executable. Some distributions configure GCC so that it creates position-independent executables by default (usually this requires using -pie
and -fPIC
options).– Sergey Vlasov
Mar 10 at 15:06
The
file
utility can show shared object
for an ELF executable if it is a position-independent executable. Some distributions configure GCC so that it creates position-independent executables by default (usually this requires using -pie
and -fPIC
options).– Sergey Vlasov
Mar 10 at 15:06
1
1
@MrLister: Although traditional BASIC implementations used $ as a suffix for string-variable names, I wouldn't expect a trailing $ to have similar meanings in C. If I was examining code that used such a suffix, I'd expect that the programmer was exploiting some special way that the target implementation would process identifiers with such a suffix. For example, a compiler targeting a platform which can access objects near the frame pointer faster than those which are further away might place all objects whose names have a trailing
$
after those that don't.– supercat
Mar 10 at 17:41
@MrLister: Although traditional BASIC implementations used $ as a suffix for string-variable names, I wouldn't expect a trailing $ to have similar meanings in C. If I was examining code that used such a suffix, I'd expect that the programmer was exploiting some special way that the target implementation would process identifiers with such a suffix. For example, a compiler targeting a platform which can access objects near the frame pointer faster than those which are further away might place all objects whose names have a trailing
$
after those that don't.– supercat
Mar 10 at 17:41
|
show 6 more comments
2 Answers
2
active
oldest
votes
You get a warning with -std=c89 -pedantic
. C99 and later allow other implementation-defined characters in identifiers.
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
add a comment |
According to this : GCC Documentation
In GNU C, you may normally use dollar signs in identifier names. This
is because many traditional C implementations allow such identifiers.
However, dollar signs in identifiers are not supported on a few target
machines, typically because the target assembler does not allow them.
So, $
is valid, but it's not a conforming way to code in C.
6
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
1
@Spidey with-std=c11
no warning appears
– Federico klez Culloca
Mar 10 at 11:21
1
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
1
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
1
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55087023%2fwhy-is-gcc-not-showing-a-warning-message-for-using-in-a-variable-name%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You get a warning with -std=c89 -pedantic
. C99 and later allow other implementation-defined characters in identifiers.
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
add a comment |
You get a warning with -std=c89 -pedantic
. C99 and later allow other implementation-defined characters in identifiers.
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
add a comment |
You get a warning with -std=c89 -pedantic
. C99 and later allow other implementation-defined characters in identifiers.
You get a warning with -std=c89 -pedantic
. C99 and later allow other implementation-defined characters in identifiers.
edited Mar 10 at 11:41
answered Mar 10 at 11:20
nwellnhofnwellnhof
23.8k46085
23.8k46085
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
add a comment |
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
Yes. This is the reference: gcc.gnu.org/onlinedocs/gcc-8.2.0/cpp/…
– Apoorv Potnis
Mar 10 at 11:34
add a comment |
According to this : GCC Documentation
In GNU C, you may normally use dollar signs in identifier names. This
is because many traditional C implementations allow such identifiers.
However, dollar signs in identifiers are not supported on a few target
machines, typically because the target assembler does not allow them.
So, $
is valid, but it's not a conforming way to code in C.
6
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
1
@Spidey with-std=c11
no warning appears
– Federico klez Culloca
Mar 10 at 11:21
1
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
1
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
1
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
add a comment |
According to this : GCC Documentation
In GNU C, you may normally use dollar signs in identifier names. This
is because many traditional C implementations allow such identifiers.
However, dollar signs in identifiers are not supported on a few target
machines, typically because the target assembler does not allow them.
So, $
is valid, but it's not a conforming way to code in C.
6
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
1
@Spidey with-std=c11
no warning appears
– Federico klez Culloca
Mar 10 at 11:21
1
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
1
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
1
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
add a comment |
According to this : GCC Documentation
In GNU C, you may normally use dollar signs in identifier names. This
is because many traditional C implementations allow such identifiers.
However, dollar signs in identifiers are not supported on a few target
machines, typically because the target assembler does not allow them.
So, $
is valid, but it's not a conforming way to code in C.
According to this : GCC Documentation
In GNU C, you may normally use dollar signs in identifier names. This
is because many traditional C implementations allow such identifiers.
However, dollar signs in identifiers are not supported on a few target
machines, typically because the target assembler does not allow them.
So, $
is valid, but it's not a conforming way to code in C.
edited Mar 10 at 21:13
answered Mar 10 at 11:11
Arnaud PeraltaArnaud Peralta
1,161918
1,161918
6
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
1
@Spidey with-std=c11
no warning appears
– Federico klez Culloca
Mar 10 at 11:21
1
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
1
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
1
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
add a comment |
6
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
1
@Spidey with-std=c11
no warning appears
– Federico klez Culloca
Mar 10 at 11:21
1
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
1
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
1
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
6
6
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
It's not valid C, only on GCC C. Try compiling with -ansi or -std=C11 and the warnings will start appearing.
– Spidey
Mar 10 at 11:14
1
1
@Spidey with
-std=c11
no warning appears– Federico klez Culloca
Mar 10 at 11:21
@Spidey with
-std=c11
no warning appears– Federico klez Culloca
Mar 10 at 11:21
1
1
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
Try adding -Wall then, to show more warnings.
– Spidey
Mar 10 at 11:26
1
1
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
@Spidey nope, still no warnings.
– Federico klez Culloca
Mar 10 at 11:27
1
1
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
@Spidey: The Standard has no definition for "valid C". Its definition for a "conforming C program" encompasses any blob of text that is acceptable to at least one conforming C implementation. A source text that uses dollar signs in identifiers could not be a "strictly conforming proogram", but the authors of the Standard recognize that much C's usefulness stems from the ability to write non-portable programs that will be usefully processed by some C implementations even if not by all of them.
– supercat
Mar 10 at 17:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55087023%2fwhy-is-gcc-not-showing-a-warning-message-for-using-in-a-variable-name%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
8
Unrelated, but the
.o
extension is usually used for object files, not for the final executable.– Federico klez Culloca
Mar 10 at 11:23
3
There's no extension for executables in *nix systems. The filesystem doesn't use that to determine the type of a file. So usually executables just don't have extensions and
practice
is correct. Check your/usr/bin
directory and you'll see that the programs there don't have an extension either.– Federico klez Culloca
Mar 10 at 11:37
2
About the fact that its properties say "shared library" is probably because of your desktop environment. If I do
file practice
from the command line I getpractice: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=928002f23b27d5c9bc55a15bf769edfaf3e62c23, not stripped
– Federico klez Culloca
Mar 10 at 11:40
1
The
file
utility can showshared object
for an ELF executable if it is a position-independent executable. Some distributions configure GCC so that it creates position-independent executables by default (usually this requires using-pie
and-fPIC
options).– Sergey Vlasov
Mar 10 at 15:06
1
@MrLister: Although traditional BASIC implementations used $ as a suffix for string-variable names, I wouldn't expect a trailing $ to have similar meanings in C. If I was examining code that used such a suffix, I'd expect that the programmer was exploiting some special way that the target implementation would process identifiers with such a suffix. For example, a compiler targeting a platform which can access objects near the frame pointer faster than those which are further away might place all objects whose names have a trailing
$
after those that don't.– supercat
Mar 10 at 17:41