Re: Test Your C Skills - Errors



In article <1177014398.161636.244780@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
quarkLore <agarwal.prateek@xxxxxxxxx> wrote:
Undefined behavior
doesnt mean that it will give unpredictable behavior or your PC will
go berzerk but behavior will depend on the compiler and platform

I believe you are referring to unspecified behaviour, not
undefined behaviour. Undefined behaviour is a license for
anything to happen, including the possibility that the program
will appear to work perfectly the first 50 times, but will accidently
trigger an electric shock to your company president the first time
he or she runs the program.

This may sound rediculous, but it could be, for example, that
your president happens to be the only user with a particular
letter at a particular offset in their username, and that that
location is getting interpreted as an instruction, with
that particular character happening upon the only CPU
instruction that locks up the CPU, shorting out the databus
that then cascades to other hardware failures.

--
"It is important to remember that when it comes to law, computers
never make copies, only human beings make copies. Computers are given
commands, not permission. Only people can be given permission."
-- Brad Templeton
.



Relevant Pages

  • Re: [PATCH] x86 - Enhance DEBUG_RODATA support - alternatives
    ... has been pulled out of the x86 tree. ... text_poke required to support this. ... correctly and so the CPU HOTPLUG special case can be removed. ... When you use this code to patch more than one byte of an instruction ...
    (Linux-Kernel)
  • Re: Simple function arguments
    ... are 2 names refering to the same memory location and use that. ... In the internals of a CPU there are various registers. ... address is stored from where the next instruction from memory is read and executed. ... what is generally referred to as 'The stack'. ...
    (comp.lang.cpp)
  • Re: wikipedia article
    ... parallel but skewed by one instruction. ... If the first CPU instruction execution causes a miss, ... memory access. ... distinguish between instruction and data references, ...
    (freebsd-questions)
  • Re: [PATCH] x86 - Enhance DEBUG_RODATA support - alternatives
    ... has been pulled out of the x86 tree. ... text_poke required to support this. ... correctly and so the CPU HOTPLUG special case can be removed. ... When you use this code to patch more than one byte of an instruction ...
    (Linux-Kernel)
  • Re: How does this make you feel?
    ... >>>primitives to implement, say, a memcpy just as efficiently as microcode ... > The work is offloaded from the programmer in any case - this type of code ... library macros need updating for new CPU products, ... And designing such instruction such that they don't ...
    (comp.arch)