updating oE poke4


<built-in> procedure poke4(atom addr, object x) 

stores one or more double words, starting at a memory location.

  1. addr : an atom, the address at which to store
  2. x : an object, either a double word or a non empty sequence of double words.

Poking in memory you do not own may be blocked by the OS, and cause a machine exception. If you use the define safe these routines will catch these problems with a Euphoria error.


There is no point in having poke4s or poke4u. For example, both +231 and -(231) are stored as #F0000000. It is up to whoever reads the value to figure it out.

It is faster to write several double words at once by poking a sequence of values, than it is to write one double words at a time in a loop.

Writing to the screen memory with poke4 can be much faster than using puts or printf, but the programming is more difficult. In most cases the speed is not needed. For example, the Euphoria editor, ed, never uses poke4.

The 4-byte values to be stored can be negative or positive. You can read them back with either peek4s or peek4u. However, the results are unpredictable if you want to store values with a fractional part or a magnitude greater than 232, even though Euphoria represents them all as atoms.

Example 1:
 a = allocate(100)   -- allocate 100 bytes in memory 
-- poke one 4-byte value at a time: 
poke4(a, 9712345) 
poke4(a+4, #FF00FF00) 
poke4(a+8, -12345) 
-- poke 3 4-byte values at once: 
poke4(a, {9712345, #FF00FF00, -12345}) 
See Also:

Using Data Double Words, peek4s, peek4u, poke, poke2, allocate, free, call

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu