Changes type from int to size_t#18
Changes type from int to size_t#18valeriyvan wants to merge 2 commits intocraigsapp:masterfrom valeriyvan:patch-1
int to size_t#18Conversation
Changes type from `int` to `size_t` to stop compiler complaining "Implicit conversion loses integer precision: `unsigned long` to `int`".
|
In this case I would prefer: for (int j=(int)events.size() - 1; j >= 0; j--) {since |
|
(I can make the change or you can update the pull request). |
|
I don't think what you propose is correct. |
|
I see your point! |
|
I will have to think about this more. In theory your are correct since arrays cannot have negative sizes, but in practice I do not like using unsigned ints for iterators when I know that the size of the array is guaranteed to be much less than 2000000000. Here is an example snippet of code: The problem is that I am using the index of And probably the main reason I do ints is (or now was) for cross-compiler compatibility. I was using Visual C++ 6.0 a long time ago, and I do not think that it had a Also note that humlib uses tab indentation (unlike verovio which uses four spaces :-) |
I believe |
You said about portability, not me. What about 32 bit architectures. What about 16 bit? Casting to Not to say that casting from |
|
The problem is that the C++ compiler in my head is pre C99 😜 I disliked all of the compiler changes up until C++11, so I am using a hybrid of Borland C++92 and C++11 (with an occasional C++14 added).
I was thinking that you would say that, but I am not interested in compiling my code on 16-bit computers anymore :-) |
Changes type from
inttosize_tto stop compiler complaining "Implicit conversion loses integer precision:unsigned longtoint".