[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: c++ question.
From: Tomaz Canabrava <tomaz.canabrava () gmail ! com>
Date: 2010-09-02 20:36:02
Message-ID: 201009021736.02700.tomaz.canabrava () gmail ! com
[Download RAW message or body]
On Thursday 02 September 2010 16:54:19 Jaime wrote:
> Hi,
> I do not know what this methods do,
> They use a [-1] array index, perhaps to do pointer arithmetic?, but
no pointer aritimetic. it's just that the -1 is actually the biggest number
you can find using an unsigned int. so, it's 0xFFFFFFFFFFFFFFFFFFF ( or
something near =p )
instead of hardcoding the biggest number that you may find, since they change
depending on the hardware, -1 will always be it.
Tomaz
> I do not know, it is the first time I see negative indexes in C++
> arrays.
>
> They are in kdebase/runtime/kioslave/man/man2html.cpp
> lines 2845, 3166, 3661, 3693, 3732, 3791, 4067 and 4163.
> Here you have an extract:of the first case...
>
> char *wordlist[max_wordlist];
> fill_words(c, wordlist, &words, true, &c);
> for (int i=0; i<words; i++)
> {
> if ((mode) || (inFMode))
> {
> out_html(" ");
> curpos++;
> }
> wordlist[i][-1]=' '; <---------------- The unknown thing for
> me out_html( set_font( (i&1) ? font2 : font1 ) );
> scan_troff(wordlist[i],1,NULL);
> }
>
> Best Regards.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic