Is there a rule, when to name it size and when length?
If we talk about a string it is string length, if we talk about a file it is file size.
Is any rule for that?
Size or length
Size or length
macOS Catalina 10.15.7
Re: Size or length
There's no standard rule. I say string size instead of string length sometimes. It's interchangable.
Re: Size or length
personally, i stick with size in bytes, and length in characters. for arrays etc. i use count as the total number of elements, and bound for the last accessible index (count - 1).
c ya,
nco2k
c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
Re: Size or length
Size and Length are often different things. The Length of "hello" is obviously 5, but the size (to me) could be 5, 6, 10, 12, 20 or 24 Bytes because that depends on the required storage Unit for each character and if additional info is needed like a terminating zero. At least that definition is unambiguous / clear.
ps: I'm glad we usually don't need to discuss the size of a byte anymore as we commonly assume a byte to be 8 bit's nowadays.
https://en.wikipedia.org/wiki/Byte
pps: like nco said
ps: I'm glad we usually don't need to discuss the size of a byte anymore as we commonly assume a byte to be 8 bit's nowadays.
https://en.wikipedia.org/wiki/Byte
pps: like nco said