Jump to content

Ubound principle


Recommended Posts

No that wouldn't be logical at all, think about it, it's like saying a function deisgned to count the chars in a string would'nt count the last char.

And even though you almost always have to use Ubound()-1 it's not that big of a deal.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

No that wouldn't be logical at all, think about it, it's like saying a function deisgned to count the chars in a string would'nt count the last char.

And even though you almost always have to use Ubound()-1 it's not that big of a deal.

In other languages Ubound returns the last index I guess. And the name also refers to "Upper Bound".

I think it isn't a very intuitive word for returning a size or length.

Link to comment
Share on other sites

In other languages Ubound returns the last index I guess. And the name also refers to "Upper Bound".

I think it isn't a very intuitive word for returning a size or length.

What languages are you referring to?

This has been requested in feature requests. I asked for a SizeOf or anything that hints at array size.

Link to comment
Share on other sites

In other languages Ubound returns the last index I guess. And the name also refers to "Upper Bound".

I think it isn't a very intuitive word for returning a size or length.

I agree on the last statement and it would indeed be better to call the function size() or sizeof().

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

I agree on the last statement and it would indeed be better to call the function size() or sizeof().

Even an alias function would be nice so there would be Ubound() and SizeOf() (Or Length()).

Edited by weaponx
Link to comment
Share on other sites

I see the OP's feature request was declined. I think it makes a lot more sense to have both Ubound and SizeOf. Valik's favorite word is "trivial", as in if there is a workaround using existing syntax then it is trivial to implement your own function.

See my request for a new Date UDF compatible FileGetTime() option:

http://svn.autoitscript.com/trac/ticket/160

New operators:

http://www.autoitscript.com/forum/index.ph...c=61322&hl=

I think at this point the developers are avoiding modification / addition to the AutoIt core, focus seems to be more on bugfixes, gui additions, and UDF additions. Additions to core syntax mean more documentation, more potential bugs, and changes to SciTE.

Additions to the core syntax would provide more robust and smaller code. I realize how trivial some functions are to implement but when they are written in native C++, speed is dramatically increased.

Edited by weaponx
Link to comment
Share on other sites

Yes, now it's officially rejected: http://svn.autoitscript.com/trac/ticket/224

Answer:

"It refers to the length when the array is initialized with an appropriate empty value. The behavior of UBound() is correct and will not be changed."

Actually that answer isn't quite clear to me. Could someone explain? :D

Edited by amokoura
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...