K
Keith Thompson
Interesting that it has *no* values, since it could hold one
without requiring any space.
Yes, but how would that be useful?
Interesting that it has *no* values, since it could hold one
without requiring any space.
As of the last committee meeting, it now has "alignof", too.
Keith said:C99 does the same thing, of course (I had forgotten about that).
Except that they're macros, not keywords, but it's the same idea.
Or you can just write:
#include <iso646.h>
int main(void)
{
int x=5, y= 4, a=0;
/* ... */
if(x> 1 and y< 2)
/* Do something. */
else
if(x> 10 or y> 10)
/* Do something else. */
if(not a)
/* Do something. */
return 0;
}
None of the vertical whitespace in your code was necessary or helpful
in reading the code. (*Three* blank lines between #include <iso606.h>
and int main(void)? Why??)
Ioannis Vranos said:Keith Thompson wrote: [...]None of the vertical whitespace in your code was necessary or helpful
in reading the code. (*Three* blank lines between #include <iso606.h>
and int main(void)? Why??)
Well, that whitespace didn't harm either.
Is it? Which part? I've certainly argued that asctime()'s behavior
was already well defined, and that its problems, including its
undefined behavior given exotic arguments, are not terribly
important.
Strange.
Did nobody ever notice during debugging that object files contained mangled
names?
(Or was a toolchain used with a more advanced linker that doesn't have
to mangle names?)
Nobody ever used ``new'', ``class'', or any other C++ keyword, as a name and
wonder why the compiler was rejecting a perfectly good C identifier?
How about linkage; didn't anyhone ever notice what libraries are being
linked to the code?
Did their toolchain not have a separate C++ library
for C++ programs?
Nick Keighley said:does that constitute "justifying asctime()'s misgivings"? or
"downplaying the issue's importance"? It implies that people are
defending the flaws in asctime(). I don't use asctime() because the
output isn't in a form I find useful. asctime() isn't particularly
difficult to use correctly; it's a bit like complaining about strcpy()
or sprintf(). People should be aware it has issues (as do many other
standard library functions) and work around them. It simply doesn't
warrant navia levels of hysteria.
For years the huge majority of programmers (yes, in my experience) have
used "sizeof(n)" . Where n is a number, type or "object",
One syntax that works, and is easy to read. There is nothing more "beautiful"
about
x=x+sizeof n;
than
x=x+sizeof(n);
(e-mail address removed) (Richard Harter) writes:
Why essential?
useful
A lot of programmers have gone through life not realising it no ill
affects.
What errors did they introduce by thinking that? It's not like there are
no bigger fish to fry.
As of the last committee meeting, it now has "alignof", too.
This is one of those cases where "you" is ambiguous. I shall do
you the honor of assuming that you weren't violently misreading
what I wrote. That said, I disagree. It is not a matter of
"should", it is a matter of "is". In C there is a wall between
the program and the compiler's information; there is very little
access to compiler metadata. It is a hack because it is an
ad-hoc device to get a piece of metadata.
Richard wrote:
I'm OK providing entertainment. Can you provide an instance of a voids
holding anything at all?
There is no void type. There is however a void* type. I don't find where a
function pointer can be assigned to a variable of type void*. Do you?
Eric Sosman said:"Must every little keyword have a jargon all its own?" (With
apologies to Jerome Frank).
The `while' keyword -- and `for' and `if' and `return' and
others not mentioned -- are a part of the required syntax of the
statements in which they appear, that's all. We don't need a
special name for the white space that separates `int' from `main';
why should we need a special name for `while'?
My argument boils down to this: The Standard does not use the
term "operator" to refer to `while', so we shouldn't use it that
way either.
Keith Thompson said:The newlines were there; your newsreader just didn't display them
properly. Joe's article had the following header line:
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
which seems like an odd combination, but it showed up correctly in
Gnus.
William Ahern said:You're just being lazy when you should be doing something as simple as the
following
struct num {
enum id { Character, Short, Int, Long } id;
union {
char c;
short s;
int i;
long l;
} u;
};
Ioannis Vranos said:What I meant is that the pages display OK in other resolutions, but I
designed them for 1920x1080 resolution.
Joe Wright said:I know that.
Joe said:I know that. So it can't hold anything.Eric said:Joe said:Richard wrote:
[ snip ]
For sure. But I don't see how that has any impact on the fact that for
years voids have been used for holding "unsuitable" things. Joe
Wright's
incredulous demand for a "citation" had me in stitches.
I'm OK providing entertainment. Can you provide an instance of a
voids holding anything at all?
There is no void type. There is however a void* type. I don't find
where a function pointer can be assigned to a variable of type void*.
Do you?
There *is* a void type, saith 6.2.5p19:
The void type comprises an empty set of values; it is
an incomplete type that cannot be completed.
I know that too. Why are you telling me this instead of Richard?Since there are no values of type void, however, it is not
possible to have a void variable that holds one.
There is no guarantee that a function pointer can be converted
to or from a void* (or any other data pointer) "meaningfully."
That is, the converted pointer need not be usable, and converting
it back to the original type need not produce the original value
undamaged.
Richard said:Interesting that it has *no* values, since it could hold one
without requiring any space.
Nick said:I suppose they might be surprised that sizeof() didn't evaluate its
argument. People seem to be more likely to pass a type to sizeof()
rather than an identifier.
Channel *create_channel (int id)
{
Channel *channel = NULL;
channel = malloc (sizeof (*channel)); /* won't that deref a null
pointer? */
CHECK_PTR(channel);
return channel;
}
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.