Re: [anjuta-devel] Clang and the include files



Hi Moritz!

For the posterity: I think the mistake was that I used a signed integer 
and not an unsigned offset for the offset.

before:
gint offset = ianjuta_iterable_get_position (iter, NULL)
CXSourceLocation location = clang_getLocationForOffset (clang_tu, 
clang_file, offset);

after:
guint offset = ianjuta_iterable_get_position (iter, NULL)
CXSourceLocation location = clang_getLocationForOffset (clang_tu, 
clang_file, offset);

But as I know from the technical informatic you can use signed integers 
as unsigned integers, if you prevent an overflow. Or I'm wrong?

I doubt that this was the reason (still would rather bet on the strlen()
thing). The sourceview plugin uses gints internally and the compiler
converts from guint to gint automatically (as long as you don't use
pointers). If we had a integer overflow in the strlen of a buffer we
would most likely crash anyway, but that would be a really big text
file.

I didn't study computer science but I am pretty sure your information in
class was correct.

Regards,
Johannes

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]