• Thr 2018.10.11

    re: http://forum.espruino.com/conversations/­316941/
    'You can even access data stored in flat strings:'

    What is a 'flat string' and how is it different? Definition, documentation please?
    Is it just a contiguous block, null terminated? Is there a size limit?

    Skimmed over

    http://forum.espruino.com/conversations/­316409/#comment14077573

    It appears that 'flat string' may be specific, as a quick search only uncovered one reference, other than Espruino.com

    https://dxr.mozilla.org/mozilla-central/­source/js/src/jsapi.h#4035
    'Flat strings and interned strings are always null-terminated,'


    Having issues with var addrsrc = E.getAddressOf(src,true);
    if(!addrsrc) throw new Error("Not a Flat String");

    irratically returning 'Not a flat string', loading same data each run.

    Working with

    var buffer = new ArrayBuffer(8);
    var n = new Uint8ClampedArray(buffer, 0, 4);

    and E.compiledC

    Is a flat string somehow related to Uint8ClampedArray
    Not mentioned however in

    https://www.espruino.com/Reference#t_Uin­t8ClampedArray


    Is flatAddress just a T/F flag and not the address of the variable? This implies that param should always be true, e.g. why would you supply 'false' if you are attempting to get the address of (E.getAddressOf) the variable supplied? Seems redundant.

    https://www.espruino.com/Reference#l_E_g­etAddressOf
    flatAddress - If a flat String or flat ArrayBuffer is supplied, return the address of the data inside it - otherwise 0


    I have a hunch that the size of the referenced address passed or returned is causing pointer (my code) offset errors.

About

Avatar for Robin @Robin started