what is the difference between the 2 sentences?

E

Eric Sosman

Randy said:
Jordan Abel wrote
int main(){
char string[20]={""};
string[20] = {" connected "};
}

In addition to the more helpful comments you have already received,
"string" is an identifier reserved for use by the implementation, and
you should thus not use it. (IIRC, that statement only applies if
you've included <string.h>.)

His use of the identifier does not have external linkage, nor is at file
scope, so he should be fine, at least if he hasn't included string.h or
stdlib.h [possibly even if he has, but i don't know in that case]


Irrelevant. There is nothing to prevent ISO C 200x from using
that identifier, because it is reserved explicitly for such use.
So, a new compiler comes along, and suddenly the above code
stops working. With or without string.h.

It is difficult to choose identifiers that no future
C Committee will proclaim off-limits. Did you, by any
chance, use `restrict' as an identifier? If so, what do
you think of C90's guarantee that `restrict' was in the
name space reserved for your use?
 
R

Randy Howard

Eric Sosman wrote
(in article said:
It is difficult to choose identifiers that no future
C Committee will proclaim off-limits.
True.

Did you, by any chance, use `restrict' as an identifier?

No, I never did. Pure luck I suppose.
If so, what do
you think of C90's guarantee that `restrict' was in the
name space reserved for your use?

*shrug* Better than using strrestrict I suppose. :)

Seriously, I don't use it now that it does exist, and probably
never will. I've yet to encounter a situation in which it was
needed, for that matter, I can say the same thing about
everything in C99.
 
D

Dave Thompson

On Wed, 23 Nov 2005 20:46:28 -0500, Eric Sosman
It is difficult to choose identifiers that no future
C Committee will proclaim off-limits. Did you, by any
chance, use `restrict' as an identifier? If so, what do
you think of C90's guarantee that `restrict' was in the
name space reserved for your use?

I did use 'inline'. However, stealing an identifier for a keyword
whose use(s) cannot substitute for an identifier, at least is a
required diagnostic so I am guaranteed to learn of the problem. Taking
an identifier for a library routine, or a macro that must act pretty
much like a routine, has a significant chance of silently failing.

- David.Thompson1 at worldnet.att.net
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top