Re: dereferencing or not?



"matevzb" <matevzb@xxxxxxxxx> writes:
On Dec 11, 11:02 am, Rainer Weikusat <rainer.weiku...@xxxxxxxxx> wrote:
<snip>
They are especially not different in one important aspect: C programs
for them are translated to some kind of machine code by a
deterministic process and if this machine code uses, for instance,
a pointer into nowhere, the machine will just use it, with perfectly
predictable results assuming the value that is used is known.

I agree, but the deterministic process is different for each system.
HPUX for example aligns char arrays to 2 bytes by default, so you can
use a short * for accessing it. If you do this on Solaris however, it
will most likely dump core. On HPUX accessing a structure member if the
pointer to the structure is NULL will cause SIGBUS, on Solaris it's
SIGSEGV.

Doing misaligned accesses on ARM9 Linux 2.4 will result in strange
malfunctions in the code because the default for 2.4 and ARM9 is to
disable alignment traps during the initial MMU configuration.

etc.

What are you up to?

Erm... BombiX? =)
According to Google, that is a lot of things (eg a south african silk
farm), but not what I asked for. Speculations about what 'undefined'
could mean a generally pointless. It means 'undefined' and everything
else is a matter of actual implementations one is using.
I was joking about BombiX of course. There is an example in the book
"Expert C programming - Deep C secrets" where it states that a software
error could burn out the monitor of an IBM PC (apparently by setting
video chip scan rate to 0).

Misprogramming chips that control hardware can lead to damaged
hardware. But UNIX(*) application programs cannot (generally) program
hardware controlling chips, so, a lot of nasty DOS problems can never
happen.

What are you up to?

.



Relevant Pages

  • Re: 32 bit FORTH ??? Different tack! Jona
    ... Deciphering the Z80 code for the Microkernal, and writing 6800 Machine code for the 6800 chip to use. ... is to provide an interface between applications ... Write a 'microkernal', load the FORTH "UNIX" knockoff, and you have a box running UNIX. ... AMD chips, INTEL chips, Hitachi chips, Motorola chips, etc. ...
    (comp.lang.forth)
  • Re: Vb.net - Rotating a label (used to replicate a line) OT warning
    ... that for any future VB6 VB.Net bash) But just curious are you ... I'm probably a little old fashioned but the only two languages I've ever used in earnest are machine code and BASIC. ... Of the two I used to very much prefer machine code, but that was many years ago when it was possible for one person to have an intimate knowledge of the hardware of a specific machine. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Read/copy/call a functions machine code?
    ... actual size the function takes in machine code), such that you can copy the ... It takes a pointer ... to static data areas or other functions) cannot. ...
    (comp.lang.c)
  • Re: Consciousness: whats the problem?
    ... My counter is that understanding low level hardware gives you very little ... machine code, ... a register is placed on a buss, or moved from a buss to a register. ... the micro-code is the computer. ...
    (comp.ai.philosophy)
  • Re: size of pointers
    ... computed from some other pointer by subtracting that pointer's ... The machine code for computing x is ... gcc was generating a full-blown divide for pointer subtraction.) ... Reading email is like searching for food in the garbage, ...
    (comp.lang.c)

Quantcast