Searching \ for '[OT]: Tied up with String -- Language Lawyer Strik' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/language/index.htm?key=language
Search entire site for: 'Tied up with String -- Language Lawyer Strik'.

Exact match. Not showing close matches.
PICList Thread
'[OT]: Tied up with String -- Language Lawyer Strik'
2001\07\23@175943 by Barry Gershenfeld

picon face
>And sizeof(buf) will return the size of the pointer, not the buffer!
>
>Bob Ammerman

Thank you for the explanation.  I find C rather exasperating
because I know how computers work, and I know how compilers
work, and half the time I still can't fathom what I'm supposed
to say in C to make it all work.  They seem bent on making
it "easy" rather than sensible.

>NOTE: An array name is _not_ a pointer in C.

I appreciate the pickyness of some compilers which helps me
to really keep track of what I'm actually coding, but sometimes
I just can't figure out what the problem is.  I'm not sure the
above corresponds to this particular problem, but sometimes
I think I'm being forced to cast a char pointer to a char pointer
in order to make the compiler happy.

Also, as I do investigate the syntax by trying and seeing
what works, it seems I can be mislead...

>There are at least two places where treating the array name as a pointer
>breaks down:
...
>2) [Optional for advanced language-law students] There is actually an
>exception to the rules described in 1 and 2, above...

This is great, because once I get something to work, then I
can assume I've got the syntax right.   Except I can't,
because sometimes it "works anyway".

...
>When using the array name in a sizeof operation, you get the size of the
>entire array, _not_ the size of a pointer to the elements.

I can hardly ever get sizeof() to report what I think it should.
Now I find that the "answer" may change depending on where I use it!

I do have K&R and I do look at it but I sometimes wish things
were explained in terms of implementation, and not just
"correct language".

Barry

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...