![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
It was what I meant. :oEdit: Ah yeah stupid, '\0' will result in false too of course (as it is 0). Not just only the 'normal' 0.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates Last edited by nnxion; Apr 3rd, 2006 at 7:00 AM. |
|
|
|
|
|
|
#12 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
Actually C ran mostly on DEC PDP-8 systems at Bell Labs in the beginning. Those had
8K-32K of core. Anything you could do to make a routine occupy less memory was a good idea. void functions save two bytes on the stack frame because they don't return a value. void strcpy(char *dest, char *src)
{
while((*dest++=*src++) );
} |
|
|
|
|
|
#13 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
I thought functions returned values by putting the return value in the eax register?
|
|
|
|
|
|
#14 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
Actually, Jim, very early C did not even have the void keyword. void return types (and void pointers) were originally introduced as an unofficial extension of K&R C by a number of vendors, including AT&T, and eventually found their way into ANSI/ISO C. The reason usually cited for the introduction of void return from functions, as you suggest, was to allow minimisation of memory used when calling/returning from a function.
Polyphemus_ : Placing a return value into the eax register is a convention used by some compilers on particular hardware and OS. It is certainly not universal. Not all machines have an eax register (heck, some machines don't even have registers). |
|
|
|
|
|
#15 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Storage media didn't have a lot of capacity, either. The first floppies I used were 8-inch, 120K. Digitally recorded cassette tapes were in the 50K - 200K range. Recording density was low enough that one could, using Magnasee, observe individual flux transitions with a 10x loupe or even less.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#16 | |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Quote:
![]()
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
|
|
|
#17 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: New Mexico
Posts: 228
Rep Power: 4
![]() |
grumpy is correct - the "standard" version of C did not support void to start with.
However, Morristown sent out free Unix and C tapes (you had to return the tape). By 1980 there were "mixed" versions floating around from umpteen different places like Berkley. We had System VII (yes, Grumpy that's correct) unix on a PDP in 1981(?) for a major parking violations project. Several of us went to Morristown on a collaborative project, and along the way we picked up crabs. If grumpy was around back then he knows about crabs. It ain't what you think... |
|
|
|
|
|
#18 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
May be a bit before my time, Jim. For some reason your post made me think of the Maryland Crab, from an article related to parallel computing I read some years back. My knowledge is definitely not first hand though.
|
|
|
|
|
|
#19 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 6
![]() |
lots of interesting replies...thanks!
i think this summer i will go through the k&r and stroustrup's book to get a better handle on things.
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|