Re: Pass by ref vs. value
From: Wolfie (bgbdwolf_at_gte.net)
Date: 05/17/04
- Next message: Patrick de Ridder: "Re: C++ books"
- Previous message: George Huber: "Re: Choice of smart compiler"
- In reply to: RobertMaas_at_YahooGroups.Com: "Re: Pass by ref vs. value"
- Next in thread: Greg Comeau: "Re: Pass by ref vs. value"
- Reply: Greg Comeau: "Re: Pass by ref vs. value"
- Reply: RobertMaas_at_YahooGroups.Com: "Re: Pass by ref vs. value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 17 May 2004 04:10:32 GMT
RobertMaas@YahooGroups.Com wrote:
> Notice how you can cast a void
> pointer (return value from malloc) to any pointer type you want, for
> example you can allocate just one byte of memory but then cast the
> pointer to point to more than one byte, and call a function that
> clobbers all those bytes of memory, not just the one byte you
> allocated but several more bytes after it, and who knows what will
> happen, and the compiler and runtime system provide no protection
> against this. That's one reason only expert programmers who are
> careful not to make such mistakes should ever program in C.
It's one reason why even a beginning programmer should be wary
of casts, not a reason to avoid a whole language.
> (Why C, instead of LISP, is often taught as a first programming
> language for rank beginners is a great mystery to me. Maybe to
> scare away all but the best students, to reduce the number of
> unemployed programmers?)
C is a simple language that's incredibly easy to learn. It's like
chess, though -- few rules to learn but a 'lifetime' to master.
More than that, by learning C -- memory usage, the difference
between types, etc. -- one gets a fairly good feel for how the
platform actually works, something that's important to know
IMO.
- Next message: Patrick de Ridder: "Re: C++ books"
- Previous message: George Huber: "Re: Choice of smart compiler"
- In reply to: RobertMaas_at_YahooGroups.Com: "Re: Pass by ref vs. value"
- Next in thread: Greg Comeau: "Re: Pass by ref vs. value"
- Reply: Greg Comeau: "Re: Pass by ref vs. value"
- Reply: RobertMaas_at_YahooGroups.Com: "Re: Pass by ref vs. value"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|