pinback wrote:Totally off the subject:
Tdarcos wrote:I've got "yeast in beer" complaints
What is a "yeast in beer" complaint?
Thanks. I'll hang up and listen off the air.
A "yeast in beer" comment is one in which the issue isn't critical, it's a matter of opinion. Some people don't care about finding pieces of yeast floating in their beer, some do not like it, and some do like it.
So, for example, the guy codes like this:
Code: Select all
dosomething;
if this=that then
begin dosomethingelse; movesomething(here,there); end;
for i := 1 to 5 do
begin
...
end;
...
Whereas I'd probably do it like this:
Code: Select all
dosomething;
if this=that then
begin
dosomethingelse;
movesomething(here,there);
end;
for i := 1 to 5 do
begin
...
end;
...
Mostly minor formatting differences, I prefer to put begin/end blocks on separate lines from code. I prefer an indentation of 4 over his of 1. A disagreement of opinion and basically, if the practice is consistent, it's not critical.
I find it's easier to read code the way I do it and it makes modules less complex because you have one action per line. There are exceptions where I'd have multiple instructions on the same line, like if I'm building an array of entries, I might do something like this:
Code: Select all
I := 1;
item[i] := "Base"; I:=i+1;
item[i] := "Displacement"; I:= I+1;
item[I] := "Register";
itemcount := I;
If I was initializing two arrays that are related then I might initiialize both on the same line.
This way I don't use constants and if I need to insert an item I don't have to renumber everything below it.
There are times where arrays make sense and where linked lists with pointers do. I've read various sources to Pascal compilers (which usually are themselves written in Pascal), and what I've found is they often do both. The list of reserved words is small and can be initialized at run time, this is often stored in an array.
The user's program data such as identifiers, since they don't know how big the program will be, identifiers are typically stored in a linked list. Now, the list should be alphabetized so that if a new identifier is defined, it's inserted in the list immediately after the item alphabetically higher than it. You also might have scope lists, because if you define I in a procedure it overrides I in the main program. Same for variables defined in the header of a procedure.
Whether you use arrays vs. linked lists is a matter of choice and what you have available in your language. Now, if you have a small number of items and you may want to access an item in the middle, or you're doing searches, an array might be bettter than a linked list since linked lists generally are not subject to random searches, you can go down the list or up the list but you can't go in the middle.
Now I suspect you could simulate arrays in a linked list but it would be difficult; but if you can have variant arrays where the array can be resized at will then you may have some capacity there.
If you're having to sort, say, 100 million items by reading them into memory instead of disk sorting, pointers may not get you as good a result as arrays if you can create array structures on the fly.
With being able to have gigabytes of memory on a machine it opens up new options for faster processing. (This machine I'm using has 3 GB.) Machines running 64-bit operating systems can support 8GB of memory.