K
Keith Thompson
Army1987 said:Neither can a pointer parameter be NULL, if the function is called
properly.
For certain values of "properly":
printf("NULL = %p\n", (void*)NULL);
Army1987 said:Neither can a pointer parameter be NULL, if the function is called
properly.
cr88192 said:OE does this annoying thing, far too often, of leaving out all the '> 's. I
have not been able to figure out why, or how to fix it, so often, I am lazy
and just use the '< ... >' convention.
otherwise, I have to go and manually add '> ' to damn near every line, and
this is most often not worthwhile.
Richard said:CBFalconer said:
Er, so?
It doesn't look the same to me. In one case, you have T *bar, and
in the other, you have T& bar.
This is not obvious to me. They take different parameter types,
so they can't be the same function.
Richard said:James Kanze said:
.... snip ...
The comp.lang.c group has no charter. I'm not sure about
comp.lang.c++ - to which this thread is crossposted - but I would
guess that it doesn't have a charter either; and even if it does,
it's very unlikely that it constrains the group to subjects
relevant only to C implementations!
cr88192 said:no, I did not. note the:
<
and
around that chunk of text.
cr88192 said:.... snip ...
OE does this annoying thing, far too often, of leaving out all the
'> 's. I have not been able to figure out why, or how to fix it,
so often, I am lazy and just use the '< ... >' convention.
otherwise, I have to go and manually add '> ' to damn near every
line, and this is most often not worthwhile.
You mean, "RJH-conforming".
Typical of this group - they throw the rulebook at everyone in sight
when actually they've made it all up themselves.
Look at the generated machine code
James Kanze said:
The comp.lang.c group has no charter.
I'm not sure about comp.lang.c++ - to which this thread is
crossposted - but I would guess that it doesn't have a charter
either; and even if it does, it's very unlikely that it
constrains the group to subjects relevant only to C
implementations!
I agree with you, however, that extensions are not considered
topical in comp.lang.c (nor, as far as I'm aware, in
comp.lang.c++).
Nevertheless, I think you're wrong to suggest that an
implementation that provides extensions cannot be a C
implementation. The ISO C Standard explicitly permits
extensions.
c.l.c, being older than charters has none.
Having no charter, c.l.c. cannot have one that insists on
anything. It continues as one of the oldest and most
successful newsgroups because of the vigilance of regular
posters in attempting to persuade others to stick to C which
has application across platforms, namely the C of one of the
standards from ANSI C89 on or of pre-standard K&R C.
Particular implementations, mainstream or otherwise, tend to
have their own newsgroups or mailing lists, or, when they do
not, one easily started. Suggestions for changes in the
standard language are best taken care of in comp.std.c.
People who transgress this by repeated plugging their own
non-standard implementations and repeatedly asserting that
their non-standard extensions should be accepted as C -- their
wisdom exceeds that of the user community and standards-making
bodies -- are nothing more than saboteurs.
Certainly. As long as there is a diagnostic if the input is ill
formed according to the C standard. If lcc-win compiles
something along the lines of:
struct S operator+( struct S&, struct S& ) ;
without a diagnostic, it isn't a C compiler. (Change operator
to __operator, of course, and it could be.)
Richard said:CBFalconer said:
C doesn't require an implementation to generate machine code.
James Kanze wrote:
[big snip]
I should includeCertainly. As long as there is a diagnostic if the input is ill formed
according to the C standard. If lcc-win compiles something along the
lines of:
struct S operator+( struct S&, struct S& ) ;
without a diagnostic, it isn't a C compiler. (Change operator to
__operator, of course, and it could be.)
<operators.h>
with
#define __operator operator
OE does this annoying thing, far too often, of leaving out all the '> 's. I
have not been able to figure out why, or how to fix it, so often, I am lazy
and just use the '< ... >' convention.
James Kanze said:It had one 15 years ago. At least, people quoted it, and posted
links to it.
In sum, what is commonly understood to be "C".
Presumably, even before C99 was adopted, something like "long
long" would have been acceptable, because "long long" was
supported by a large number of C compilers.
Army1987 said:Neither can a pointer parameter be NULL, if the function is called
properly.
When was the charter eliminated? It has one 15 years ago, when
I was still reading it regularly. (15 years ago, it was
impossible to create a group without a charter.)
[/QUOTE]You mean, "RJH-conforming".
Typical of this group - they throw the rulebook at everyone in sight
when actually they've made it all up themselves.
So true. So true.
<
The sense of using references in ?++ instead of pointers is to avoid
annoying checking pointers for NULL
For example if you have a function that accepts reference as a
paramater you do not have to check the reference
for NULL ( 0 ) before using it because references cannot be NULL but
if you have a pointer you should always check it
for NULL before you invoke member functions otherwise you might get
access violation error.
as noted by others, references are non-standard in C (as such, they are only
really valid in C++, and it is good not to confuse C and C++, as they are
different languages).
however, it is also nicer to be able to type:
x=3;
than:
*rx=3;
this can actually matter some with more non-trivial argument types (char as
'char *'), where the common practice becomes to extract the value from the
pointer, work on it, and store it back before return (this is a very common
pattern in things like parsers, ...).
reason:
int foo(char **rs)
{
...
}
rs++; //wont do what you want
*rs++; //seems like it would work, but it does not (does something
different)
(*rs)++; //is problematic IME.
so, afaik, about the only really safe option here is:
*rs=*rs+1;
so, common is to have to be like:
int foo(char **rs)
{
char *s;
...
s=*rs;
...
*rs=s;
return(i);
}
so, references can have some uses...
Chad said:If you have something like
int foo(char **rs)
{
...
}
The how could something like
(*rs)++;
be problematic?
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.