cc: [email protected]
Subject: Re: [ast-users] Number of elements for declaring an indexed array via  
'typeset pbargs[]' vs. 'typeset -a pbargs' ?
--------


> Where is the difference between the following two array declarations:
> -- snip --
> ksh93 -c 'typeset pbargs[] ; print ${#pbar...@]}'
> 1
> $ ksh93 -c 'typeset -a pbargs ; print
> ${#pbar...@]}'                                                                
>   
>    
> 0
> -- snip --
> 
> Somehow it looks for the first form ('typeset pbargs[]') some kind of
> "hidden" empty array element gets created - is this a bug or a feature ?
> 
> 

The [] is in invalid subscript so this should be an error.
The shell is interpreting this as 0 and defining the 0th element.
I will generate a syntax error for an empty subscript.

David Korn
[email protected]
_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to