sh.1 doesn't document the bool type. Is this an oversight or is bool still experimental?
Wendy ---------- Forwarded message ---------- From: Irek Szczesniak <[email protected]> Date: 4 December 2012 14:33 Subject: [ast-developers] [rfe] typeset -B to define a (C99-like) <stdbool.h> datatype To: [email protected] I'd like to propose a new typeset option to define a new boolean datatype which works like C99 "bool" datatype defined in <stdbool.h>, e.g. typeset -B bl; integer i; (( bl=true, i=bl )) ; print "$bl\n$i" prints $'true\n1\n' The purpose is to have a (memory space-)efficient way to define a boolean datatype in shell scripts which can be used with arithmetic expressions and arrays and works exactly like the "bool" datatype defined in <stdbool.h>. I know it is possible to define such a datatype with typeset -T right now, however we'd like to use such this datatype primarily in very large arrays, in which case usage of user-defined types becomes a memory usage nightmare. That's why "hardcoded" support via typeset -B would be beneficial - it could use bitfields instead of a nval structure and use two bits to represent a typeset -B array entry - one bit is used for the value and a 2nd bit defines whether the array entry is actually defined or not so that sparse bitfield arrays are possible. This should be at least 80 times (sizeof(struct nval)==5*sizeof(void*) vs 2 bits) more space efficient than any possible implementation via typeset -T. Irek _______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers _______________________________________________ ast-developers mailing list [email protected] http://lists.research.att.com/mailman/listinfo/ast-developers
