Either you can't read or you think arbitrarily large integer == unsigned long long. Sorry if I find your solution lacking, just stating my opinion, obviously you aren't very open to any ideas that...
Type: Posts; User: Mezzano
Either you can't read or you think arbitrarily large integer == unsigned long long. Sorry if I find your solution lacking, just stating my opinion, obviously you aren't very open to any ideas that...
No I showed you how to do it above, log10. As for the suggestion with sprintf into buf, that is great but you need to have buf be the right size. You could just have it be as many digits as the...
Yes but with the other ways suggested he must do it twice, he must loop once through the number just to calculate how large the array needs to hold the string representation of it. Then he needs to...
Why even have the ability to cast at all then, lets just take it out it is obviously useless.
No it was more, it works on every compiler I have ever used. Of course if you want to assume...
Better still do this
int res = (int) log10(number) + 1;
Yeah you get a lot of that in public discussion board about programming ;) I was in the same boat, I slept through most of HS and didn't really give a ......... One day I woke up, pulled my head...
Yes, but as I mentioned (I think I did) it is a style decision. I personally prefer not to make an extraneous variable just to hold the return value so I can see whether to do the assignment or not,...
The second one is lacking a cast but it is certainly not incorrect. What is incorrect about setting a variable to hold its own address? I mean, is it useful? Who knows ;) But it is not "wrong". ...
Hashing on a fixed size table without chaining seems a bit impossible. If you ever get up to entering 8 elements you are done, if you don't chain or rehash your table is full, game over. I realize...
I guess we can't really continue the discussion because I don't know the dirty details of the JIT'ing process. However, I do know that is has been publically stated that the JIT compiler DOES do...
To be technical that is the structure of an element in your hash table, the hash table itself is likely just an array of these things, this is what gives it O(1) lookup, on average.
No...
True but it was mentioned by the first poster so I didn't touch on that :)
Mezzano
Hmmm.... I would argue that. By that logic then a compiler could not optimize anything, because it would be unable to determine if the optimization caused a relied upon side effect not to happen. ...
I know C/C++ and C# (among other languages that don't have C's in their names), so here is my view on it.
Ease of GUI design: if you have coded GUI's in C++ you probably know you spend a LOT of...
In the original post I said "this assumes the getter is trivial", which would not be the case if it "did things other than just returning the value". I said if that was the case the compiler would...
This opens up the ugly decision about who is responsible for freeing the memory, assuming the memory for the original array was alloced. If you have them pass in a pointer to the array as it is and...
But it's not. We are talking about two calls to the same getter interspaced by no other code. Polymorphism doesn't come in to play since after the first call the result of the getter is already in...
First off you are mistaken, by definition an array is contiguous. If you don't believe me feel free to check out this nice article on MSDN concerning data structures in .NET which gives a thorough...
This is an "old" post so not sure if you are interested anymore or not..but here goes
The first line will allocate an array big enough to hold a thousand pointers (since your object is a ref...
Whats that old saying "All software engineering problems can be solved by adding another layer of abstraction, all performance problems can be solved by removing a layer of abstraction" :) Anyways,...
The problem can be solved as another user posted, just return the array. The reason it doesn't work as is is that you are passing a in by value, and then binding the local (to the init function)...
It is more C'ish but you can use memcpy or memset.
Mezzano
I was referring to the windows version as that is the only system I know that currently has a robust version of C#. Last I heard Mono, as well as another project implementing C# on linux, were still...
I would assume the compiler isn't completely braindead and will NOT call the getter twice. After the first call the pointer to the SomeDumbPropertyValue already resides in a register, thus it can be...
Cleaner is a stylistic decision, and no there would be no performance improvement it is just syntactic sugar. As for the other poster that suggested we could just go back to "gotos and functional...