[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyword /nozero in several functions + useless code ! #1818

Open
alaingdl opened this issue Apr 23, 2024 · 1 comment
Open

keyword /nozero in several functions + useless code ! #1818

alaingdl opened this issue Apr 23, 2024 · 1 comment

Comments

@alaingdl
Copy link
Contributor

2 points :

  • in basic_fun.cpp we have useless in most *arr (eg LONARR) portions of code because test of the dim are now done in arr()

e.g. :

    arr(e, dim);
    if (dim[0] == 0)
      throw GDLException("Array dimensions must be greater than 0");

but in arr()

...
      if (ret < 0) throw GDLException(BadDims);
...
      if (newDim < 1) throw GDLException(BadDims);

Would someone give a look and canfirm we can removed the useless code ?

  • /nozero is present in all the *arr functions below but STRARR

in fact : no /nozero in STRARR in IDL, and /nozero does exist in IDL for OBJARR & PRTARR but are not documented !

GDL> help,/lib, name='*arr'
Library procedures (0):
Library functions (14):
res=BYTARR([8 Args],NOZERO)
res=COMPLEXARR([8 Args],NOZERO)
res=DBLARR([8 Args],NOZERO)
res=DCOMPLEXARR([8 Args],NOZERO)
res=FLTARR([8 Args],NOZERO)
res=INTARR([8 Args],NOZERO)
res=LON64ARR([8 Args],NOZERO)
res=LONARR([8 Args],NOZERO)
res=OBJARR([8 Args])                                      <<---- missing in GDL
res=PTRARR([8 Args],ALLOCATE_HEAP)      <<---- missing in GDL
res=STRARR([8 Args],NOZERO)                    <<---- to be removed in GDL 
res=UINTARR([8 Args],NOZERO)
res=ULON64ARR([8 Args],NOZERO)
res=ULONARR([8 Args],NOZERO)
% At $MAIN$          
@GillesDuvert
Copy link
Contributor

indeed arr() checks dims are not zero. So the supplementary test is not useful. Same as some checks on number of params when e->NParam(n) has been called before.
Not an issue, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants