| PLEX86 | ||
Where should the type information be 113Christian Bau
In AWK, variables can be either strings or numbers, depending on what was stored into them last. If they are used for arithmetic operators they are converted to numbers, zero if they don't have a numeric prefix. If they are used for string operations they are converted to strings. All arrays are buttociative, subscripts are strings, and numbers are converted. There are a few bugs that can be caused by forgetting about this conversion. Where should the type information be 115 A machine architecture that has an indirect bit for effective address calculation for all instructions. +--------------- Heh! Yes, I loved... In PL-I, variables are either numeric or string, but the compiler will generate conversions when needed. I once did a PL-I program something like: DCL (A,B) CHARARACTER(30) VARYING; Where should the type information be 114 On Fri, 18 Mar 2005 16:10:23 -0700, Steve Richfie1d Maybe the problem is a sloppy language spec? I can see no really good reason not to... DO A=' 1' TO ' 100' BY '3'; B=SQRT(A); PUT SKIP LIST(A,B); END; Note that the loop variable is a character string, and the loop test is done as a character string compare. The loop increment is done by converting both strings to numbers, adding, and converting back to a string. The SQRT is done by converting to double precision floating point, calling the SQRT routine, and converting back to string. One must be careful with spaces to make the loop test terminate at the right point. -- glen
|
||||
Where should the type information be 114 Alt Folklore Computers from Newsgroups The #1 Usenet Provider on the Internet
|
||||