Re: Overview Of New Intel Core i7(Nehalem) Processor

I was pointing out that they are considered differently by the compiler not suggesting that it was a good thing to do in the code.

An array or structure is handled as a pointer. It made sense to have the difference because the CPU can't natively handle arrays and structures but it can handle pointers to same. The problem is that the syntax doesn't make it clear leading to a lot of confusion about what exactly is happening.

Reply to
MooseFET
Loading thread data ...

No, I am referring to all the things that are not "simple" types and "complex" types. Arrays, structures and functions all fall under this very broad term.

A lot of people don't realize that function names are pointers. The "()" operator means call that thing pointed to by that pointer.

I would have preferred it if the use of the name required the & in front when it was going to be processed as an address. The would have meant that passing a complex type in C would cause the whole thing to get copied onto the stack. Attempting to do this with a function that wants a pointer to the variable would be an error.

Yes it is an error but look at the sort of error it is called. It isn't "You attempted to convert a structure to a pointer". It is "You did a way bogus pointer conversion". It is that the pointer types can't be converted.

Reply to
MooseFET

What the compiler does under the covers isn't relevant to the language. You can also cast a pointer to double, but it won't mean anything.

Cheers

Phil Hobbs

Reply to
Phil Hobbs

:) Good one but not really fair. Don't insult the 4004. It was one of the first.

Reply to
MooseFET

Yeah. At least it had effective i/d space separation.

John

Reply to
John Larkin

I never said it did. I said that you can pass an array to "&", which most definitely produces a pointer. I only mentioned pointer arithmetic to make it clear what the type of the pointer is (it's a pointer to the array type, not the element type).

No, I'm elaborating upon my original statement, as you seem to be unclear on what it said.

Reply to
Nobody

It's not a meaningful classification. Arrays and structures are no more like each other than they are like integers.

Note that passing a structure to a function *does* cause the whole thing to get copied onto the stack. It's only arrays which are treated differently.

No, trying to assign a structure to a pointer isn't a pointer conversion error, it's an incompatible type error. You can suppress a pointer conversion error using an explicit cast. You can't suppress an incompatible type error as the compiler has no idea as to how it could perform the conversion. It isn't simply that it isn't letting you, it's that it *cannot* do what you ask.

Reply to
Nobody

If you used a counter instead of just a latch to hold the "code page" value, you could make the counter increment on the fetch of the last instruction of a page and thus make it so that the code could run several K without having to worry about the boundaries in the straight line code.

Reply to
MooseFET

ERROR!! C itself does not have anything to say about intermixing them, that is an implementation thing. Not does C itself have anything to say about any memory management hardware. I do hope you are not willfully conflating of the problems of poor target architectures and marginal implementations for what the language actually is.

If you meant the switcher, it only needs access to some hardware pointers. The swapper needs access to the memory management hardware and the DMA hardware and disk I/O.

Reply to
JosephKK

Sure, but those really wide 9 and 10 bit counters are slow.

John

Reply to
John Larkin

But most everybody does it that way.

Not does C itself have

I hope you are not assuming that just because a sensible compiler is possible that you can actually buy one.

John

Reply to
John Larkin

Using those registers for their intended purpose you mean. Or you pretending an obvious lack of understanding of the content of the 8086 databook?

Reply to
JosephKK

John, your prejudices are beginning to demean you.

Reply to
JosephKK

On Jun 14, 3:05 am, "JosephKK" wrote: [...]

I was lumping the memory swapping and the task switcher together as one hunk. They are the only part(s) that need access to the whole space. Everything else can be confined to its little area.

Reply to
MooseFET

DI is the Destination Index register; you're supposed to be able to use (i.e. modify) it within the function.

A lot of performance-critical code even repurposes BP (which is intended to remain fixed throughout the function) as a general-purpose register, and just indexes off SP for parameters and locals.

The only register whose "intended purpose" is as a stack pointer is SP, and that's intended to be used for both return addresses and data.

Reply to
Nobody

Sorry, but this makes no sense at all. Having a flat address space doesn't imply sections can't be protected!

--
Failure does not prove something is impossible, failure simply
indicates you are not using the right tools...
                     "If it doesn\'t fit, use a bigger hammer!"
--------------------------------------------------------------
Reply to
Nico Coesel

They could be, but usually aren't. Hence the hundreds (thousands?) of buffer overflow exploits that have been sprung on Windows.

If either memcpy was safe, or if programmers used it properly... oops, sorry, I was fantasizing.

Is there a C compiler that doesn't push everything on the stack when doing a call, or that keeps a memcpy from trashing code?

formatting link

formatting link

John

Reply to
John Larkin

things a

the

design.

Interesting, how do you make the jump or branch instructions work correctly (hit the right page)?

Reply to
JosephKK

I suggest you recheck the operation of multiply, divide, and many I/O instructions again. Not to mention iteration constructions and the use of CX. Original 8086/8088, things started changing with the

80386, and the 64-bit modes are nearly symmetrical. The addition of =46S and GS to the CS, SS, DS and ES group with the pentiums was interesting, especially with pae.
Reply to
JosephKK

On the PDP-8, the last instruction on a page would fall through to the first one on the next page. Direct jumps were only to the current page.

The 8088 did something funny with paging that allowed the DOS HIGH trick to work, locating DOS above the 1M boundary.

John

Reply to
John Larkin

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.