Re: decrement past beginning is valid?

From: Watson Davis (watson_at_watsonmusic.com)
Date: 11/17/04


Date: 17 Nov 2004 09:23:13 GMT

Ron House <house@usq.edu.au> wrote in news:419ADDFF.7050805@usq.edu.au:

> Watson Davis wrote:
>
>> What I meant by legal is that a compiler will compile it.
>
> I've read the various to-and-fro posts in this thread, and I predict
> you will get a lot of unkind things said to you and you will not
> understand why.

Well, apparently, you hadn't finished reading the to and fro of the
thread. :)

I came to the realization that:

1) I wasn't using the same definitions for words that the rest of the
group was. That's pretty common in lots of areas besides just computer
languages. Since I wasn't being strict with my definitions of terms like
"legal", I was using the term incorrectly for the discussion. I haven't
been concerned with semantic niceties like that wrt computer science in a
long time so I've got to watch my tongue on groups like this.

2) I wuz rong. Just flat out worng. I had always assumed that since
arrays are passed into functions as pointers and that you can use
subscripts with pointers, that arrays WERE pointers and it was just a
case of 2 different types of notation for virtually the same thing (like
a union and just using two different pointers pointing to the same
location.) I had assumed that if you declare something as an array of
int, that you could then take that declaration and make pointer
assignments to it... like:

   int somearray[10], *somepointer;

   *somepointer = (int) malloc(100);
   somearray = somepointer;

And you can't do that. I don't think I had ever tried to do that before
(at least, not in C or C++) and had just assumed it worked that way.

3) I also came to the realization that I've got some pretty big holes in
my knowledge base. When I went to school (back in the early '80s), my
university didn't even offer a C programming class and I had more
experience writing code than any of the instructors. (There were no
systems at my school that were running any flavor of Unix at that time.)
I started off as a BASIC and Assembler programmer, learned Pascal in
school, then moved on from there. After I graduated, I worked for a
fixed price consulting company where the owner fervently believed that
any programmer worth his/her salt could learn any language in 3 days. He
bid contracts based on that assumption. So we all learned a whole bunch
of different languages on different platforms in a big hurry.
Unfortunately, that's the way I learned C. So, my knowledge of C was/is
simply what I needed to know to code what I needed to code. And I've
been coding like that for the past 15 years.

I came to this newsgroup because I'm in the process of learning C++, just
for my own benefit, but it has really opened my eyes to a huge blind spot
of mine of which I was unaware. Fortunately (for me) and unfortunately
(for everyone else), I've never been very good at lurking; I've been a
regular on several non-technical newsgroups and a few mailing lists and
forums as well. So, if someone asks a question and I think I know the
answer (whether I do or not), I'll usually try to answer it if I have the
time. Unfortunately, in these C/C++ groups, that's turning out to be...
ummmm... opportunities for me to come face to face with my limitations.
:)

Watson (the pencil neck) Davis



Relevant Pages

  • Re: Pointer of Reference ?
    ... the problem is that pnly "traditionally trained C programmers" as a class see pointers ... If the compiler has to dereference a pointer to achieve that goal, ... ASSERT wants a Boolean value, ... the programmer is forced to actually READ THE DOCUMENTATION OR THE FUNCTION DEFINITION, ...
    (microsoft.public.vc.mfc)
  • Re: Data abstraction in C
    ... > black box of a compiler to keep you from doing what you want. ... magic and C++ and OOP aided languages aren't the only to benefit from the ... if the programmer isn't knowledgeable ... Using pointers for the code, not just the data, (I mean the function ...
    (comp.lang.c)
  • Re: Smart Pointers: Is there something similar to smart pointers in C?
    ... model helps in some ways to understand pointers), ... comment does not imply that you need to understand a machine model ... C compiler, even when given the additional advantage of using an existing C ... "Can a C programmer write a good C program without understanding ...
    (comp.lang.c)
  • Re: Learning to use PICS
    ... >>doesn't generate a ton of code to build and pass the pointers and then ... >>compiler trap silly errors and generate better code. ... > Assembly language programmers do that in 3 instructions. ... Then yes the assembler programmer could reduce it to 3 machine code ...
    (sci.electronics.basics)
  • Python and C
    ... I was a C Programmer for a while. ... one small project at school. ... Can we use Python and C together? ... Could somebody just show a real small example or give pointers to the ...
    (comp.lang.python)