Andre Poenitz <[EMAIL PROTECTED]> writes:
| On Mon, Nov 29, 2004 at 02:36:47PM +0100, Lars Gullik Bj�nnes wrote:
>> Alfredo Braunstein <[EMAIL PROTECTED]> writes:
>> | // Find position closest to (x, y) in cell given by iter.
>> | + // Used only in mathed
>> | DocIterator bruteFind2(LCursor const & c, int x, int y)
>> | {
>> | double best_dist = 1e10;
>>
>> 1e10 is not good... (but not your code)...
>
| It is mine.
>
>> double best_dist = std::numeric_limits<double>::max();
>>
>> would be a lot better.
>
| Well, better... amybe. A lot?
Well... yes.
It shows that you want to start the valua at max, not at some
arbitrary number.
| I don't expect monitors with more than 100000 pixel resolution in either
| direction to turn up soonish..
>
>> | + << " best: " << best_dist << endl;
>> | if (d <= best_dist) {
>> | best_dist = d;
>>
>> best_dist = min(best_dist, d);
>
| Why?
At least in my op. it shows intent a lot better.
>
>> | void InsetText::drawFrame(Painter & pain, int x, int y) const
>> | {
>> | - int const w = text_.width();
>> | + int w = text_.width();
>> | + if (w < 1)
>> | + w = 1;
>>
>> int const w = std::max(1, text_.width());
>
| If I read such code I always mentally translate it to the other version.
| So at least for me this is certainly less readable.
I am the opposite end.
And especially this last one where you can keep w const and initialize
once.
--
Lgb