Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
For example, this program:
#include <stdio.h>
int main(void) {
const int result = printf("%ld\n", 0.3);
printf("printf returned %d\n", result);
}
on my system prints:
140732048673560
printf returned 16
gcc and clang warn about the format string. tcc doesn't.
The (first) printf call was apparently successful because printf
has no way to know that the argument was of an incorrect type
(types don't really exist at run time).
printf() could know if an argument were of an incorrect type, if
an implementation chose to do so.
Sure. I did write "on my system", where printf has no way to know
that the argument was of an incorrect type.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:[...]
For example, this program:
#include <stdio.h>
int main(void) {
const int result = printf("%ld\n", 0.3);
printf("printf returned %d\n", result);
}
on my system prints:
140732048673560
printf returned 16
gcc and clang warn about the format string. tcc doesn't.
The (first) printf call was apparently successful because printf
has no way to know that the argument was of an incorrect type
(types don't really exist at run time).
printf() could know if an argument were of an incorrect type, if
an implementation chose to do so.
Sure. I did write "on my system", where printf has no way to know
that the argument was of an incorrect type.
The "on my system" applies to what the program prints.
The paragraph that says "printf has no way to know" is a general
statement, for any implementation of printf(). If you had meant it
to apply only to your system, you should have said something like
"because that printf had no way to know". Without any qualifying
adjective or other indicator the statement is generic, not
specific.
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
[...]
For example, this program:
#include <stdio.h>
int main(void) {
const int result = printf("%ld\n", 0.3);
printf("printf returned %d\n", result);
}
on my system prints:
140732048673560
printf returned 16
gcc and clang warn about the format string. tcc doesn't.
The (first) printf call was apparently successful because printf
has no way to know that the argument was of an incorrect type
(types don't really exist at run time).
printf() could know if an argument were of an incorrect type, if
an implementation chose to do so.
Sure. I did write "on my system", where printf has no way to know
that the argument was of an incorrect type.
The "on my system" applies to what the program prints.
The paragraph that says "printf has no way to know" is a general
statement, for any implementation of printf(). If you had meant it
to apply only to your system, you should have said something like
"because that printf had no way to know". Without any qualifying
adjective or other indicator the statement is generic, not
specific.
[...] Certainly printf has no way defined by the language to know
whether its arguments are of the correct types. An implementation
could provide that information via some system-specific method,
[...]
I'm glad to know we are in agreement.
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
I don't know why you say this. I said this:
printf() could know if an argument were of an incorrect type,
if an implementation chose to do so.
You said this:
Certainly printf has no way defined by the language to know
whether its arguments are of the correct types. An
implementation could provide that information via some
system-specific method,
To me that statement implies that an implementation could provide a
printf() function that took advantage of the argument types you say
an implementation could provide, and thus could know if an argument
were of an incorrect type. What part of what you think I am saying
do you not agree with?
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
I don't know why you say this.
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
I don't know why you say this.
And I'm ok with that. Your reactions when I've asked you to clarify
things in the past do not incline me to do the same for you.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:to clarify
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
I don't know why you say this.
And I'm ok with that. Your reactions when I've asked you
things in the past do not incline me to do the same for you.
The difference here is that I didn't just ask a question, but
gave a detailed explanation for my statement.
So your response
gives the impression of you simply not wanting to admit that
you're wrong.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
I don't know why you say this.
And I'm ok with that. Your reactions when I've asked you to clarify
things in the past do not incline me to do the same for you.
The difference here is that I didn't just ask a question, but
gave a detailed explanation for my statement. So your response
gives the impression of you simply not wanting to admit that
you're wrong.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
I'm glad to know we are in agreement.
We're not.
I don't know why you say this.
And I'm ok with that. Your reactions when I've asked you to clarify
things in the past do not incline me to do the same for you.
The difference here is that I didn't just ask a question, but
gave a detailed explanation for my statement. So your response
gives the impression of you simply not wanting to admit that
you're wrong.
| Sysop: | Tetrazocine |
|---|---|
| Location: | Melbourne, VIC, Australia |
| Users: | 9 |
| Nodes: | 8 (0 / 8) |
| Uptime: | 245:24:22 |
| Calls: | 220 |
| Files: | 21,513 |
| Messages: | 83,782 |