FRDB Archives

Freethought & Rationalism Archive

The archives are read only.


Go Back   FRDB Archives > Archives > IIDB ARCHIVE: 200X-2003, PD 2007 > IIDB Philosophical Forums (PRIOR TO JUN-2003)
Welcome, Peter Kirby.
You last visited: Yesterday at 05:55 AM

 
 
Thread Tools Search this Thread
Old 07-11-2003, 06:05 PM   #71
Veteran Member
 
Join Date: Jan 2001
Location: USA
Posts: 1,072
Default

Quote:
Sophie: (edited) I read the code and there was no indication from the code in this thread that the the code is simply attempting to randomly pick 4 different tiles out of 9 as targets.
DNAunion: Before anyone goes issuing warnings about another person’s code, as you clearly did, that person has the obligation to try to understand the part of the code that he or she is bashing. Both Principia and I posted links to the original thread, where it is blatantly obvious what the code you issued your warning on does and does not do.
DNAunion is offline  
Old 07-11-2003, 06:20 PM   #72
Veteran Member
 
Join Date: Jan 2001
Location: USA
Posts: 1,072
Default Re: possible

Quote:
DNAunion : thisElementsMemoryLocation = memoryAddressOfBaseOfArray + [((thisElementsRowIndex * COLUMNS) + thisElementsColIndex) * sizeof(oneElement)]
Quote:
Sophie: Although this may seem true, in reality the mapping of virtual addresses to real addresses is achieved through what is called a memory map. The memory mapping registers of say the 80(x)86 family of processors has the capability to assign non-contiguous blocks of physical memory to contiguous blocks of virtual memory.

In the simple format contiguity has two levels, virtual and physical, but to the ordinary programmer these levels of abstraction are never evident.

I apologise for confusing you.
DNAunion: No, you are wrong. Not even physical contiguity that you discuss is actual contiguity. You see, you've overlooked something very obvious.

The bits (and bytes) that store data are not contiguous even in physical memory. They are not actually touching each other...there is intervening space, and so they are not physically connected together to form an unbroken chain.

Of course, taking contiguous to that level makes the term worthless in regard to the discussion...just as your use of the word contiguous does.

PS: Sorry if I am talking over your head.
DNAunion is offline  
Old 07-11-2003, 06:33 PM   #73
Veteran Member
 
Join Date: Jan 2001
Location: USA
Posts: 1,072
Default

Quote:
Sophie: DNAunion, I am not sure what you are claiming here,

********************************
DNAunion: But the two subscripts are misleading…there is no real element [5, 1] in the array. That is, to access element [5, 1] the computer does not go down 6 rows and then over to the right 1 [sic, should be 2].
*********************************

Firstly your terminology is incorrect. It is the compiler not the computer that resolves the array references.
DNAunion: Nope. A compiler can't do jack squat without the functionality of the computer, which the complier "calls upon" to do tasks for it. So it is the computer that resolves the array references, even if instructed to do so by the compiler.

If what you said were true, that it's the compiler alone and not the computer, then I could take my C++ code with the two-dimensional array declaration and lay it on my C++ compiler CD and the compiler would resolve the array references. Here, let me try....Nope, didn't work for some reason. I wonder why? Oh, that's right. Because you MUST have a computer to do that for you.


Quote:
Sophie: Finally subscripts are not misleading. These are a part of data structures and their use is mainly to model data access.
DNAunion: And they are misleading (as I used the term) when they indicate that elements are stored in a two-dimensional row/col table in memory, when they are actually stored linearly and contiguously.

That really confuses you? Sorry.
DNAunion is offline  
Old 07-11-2003, 06:51 PM   #74
Veteran Member
 
Join Date: Jan 2001
Location: USA
Posts: 1,072
Default

Quote:
Lobstrosity: If your program makes an assumption that is not enforced by the language specification, your code could burn you should you change systems or compilers (or should newer systems/compilers decide to implement memory-storage differently). It's as simple as that.
DNAunion: If that's meant to be some kind of lesson about how to program, you've completely missed the mark. When I wrote the program I did NOT rely upon or assume that elements are stored in any manner not supported by all compilers, so there's no legitimate "that's bad programming" charge here.
DNAunion is offline  
Old 07-11-2003, 07:34 PM   #75
Veteran Member
 
Join Date: Jan 2001
Location: USA
Posts: 1,072
Default

Quote:
NialScorva: As to multi-dimensional arrays, how they are laid out in memory is *not* defined by the language spec, and thus can vary from compiler to compiler. You are right that &f[x][y] == f+x*SIZEY+y on most compilers, including Visual C and gcc. My point is that this isn't required to be true on all compilers or machines. ...
DNAunion: Okay, after rereading a couple of your posts I get your main point on this topic (finally!).

I can write different programs all day long that consistently "refute" you but all that shows is that the particular compiler I use allocates memory for multi-dimensional arrays the "right" way. There is nothing in the language specifications that mandates compiler XYZ to do it the same way, so my results are not universal...they only appear to successfully counter you.

Also, I do remember reading that a two-dimensional array is an array of arrays, but I misremembered it as being mostly for conceptualizing more "complex" arrays (multi-dimensional arrays containing char pointers, or pointers to pointers, for example) and not for an array containing single primitive data types as elements. Your logic eventually won me over.

What really convinces is your last discussion about possibly padding individual rows of a two-dimensional array in order to align them on particular byte boundaries. I can see why the language specifications would allow for that possibility.
DNAunion is offline  
Old 07-11-2003, 08:23 PM   #76
Veteran Member
 
Join Date: Jan 2001
Location: Median strip of DC beltway
Posts: 1,888
Default

Glad you see my point.


Resisting temptation to explain memory mapping now...
NialScorva is offline  
Old 07-11-2003, 10:13 PM   #77
Regular Member
 
Join Date: Mar 2002
Location: Nacogdoches, Texas
Posts: 260
Default

I'd just like to know what DNAUnion thinks he's accomplishing here. If he's posting here in order to learn something, then he's not listening to the responses. If he's trying to demonstrate that he's a competent programmer, he's failing at that too.

JMO.
Tom Ames is offline  
Old 07-11-2003, 10:22 PM   #78
Senior Member
 
Join Date: Feb 2003
Location: San Diego, California
Posts: 719
Default

Quote:
Originally posted by DNAunion
DNAunion: If that's meant to be some kind of lesson about how to program, you've completely missed the mark.
The irony of this statement is killing me. At least he finally seems to see the light, praise be to Allah.
Lobstrosity is offline  
Old 07-12-2003, 07:05 AM   #79
Veteran Member
 
Join Date: May 2003
Location: On the road to extinction. . .
Posts: 1,485
Default

Now I remember why they invented C++, and strong type checking in languages like Java.

Well, DNAunion, I concede the points to you again. Possibly because I do not have any other choice.

I hope you learned a few good pointers from an aging professional. I cannot claim the same, even though I wished to improve my lot when I saw the title of the thread. I did'nt know we were supposed to debug your coding. Sincere apologies emanate from these quarters.

The science you speak of is egotism, which places you in a class all by yourself. Thusly you should request a title change of the thread to read "The egotism of computer coding".

Again, I bow to a superior encoding.
sophie is offline  
Old 07-12-2003, 07:39 AM   #80
Veteran Member
 
Join Date: May 2003
Location: On the road to extinction. . .
Posts: 1,485
Default one last shot

DNAunion: And they are misleading (as I used the term) when they indicate that elements are stored in a two-dimensional row/col table in memory, when they are actually stored linearly and contiguously. That really confuses you? Sorry.

What is misleading about that Sir? If you think this is misleading, then you have a career ahead of you where you will be mislead all your career.

There is the meta-representation aspect you fail to acknowledge. The point you fail to grasp is "elements in a two-dimensional array are used as if they are in a table", the teachers exchange terms, usage of the element with storage of the element so those new to the science do not have to encounter the meta-representative at first shot. I REPEAT, using a two dimensional array is interchangeable with storing information in a two dimensional array.

You don't teach so you have no clue about this.

Secondly, when pointer arithmitic, is used past one dimensional arrays, as you have since agreed with Nial, obtaining the base address of each dimension, &foo(i,0) is recommended practice rather than calculating the offset from the zero dimension, &foo(0,0). The reason being, as you agreed with Nial, pointer arithmitic is not guarenteed to be true, crossing dimensions.
sophie is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump


All times are GMT -8. The time now is 03:24 PM.

Top

This custom BB emulates vBulletin® Version 3.8.2
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.