objective c - Confusing LLDB output -


there's hole in c knowledge here, i'm little confused why happening.

(lldb) p linegroup (nsinteger) $17 = -1 (lldb) p (linegroup > 4) (bool) $18 = true (lldb) p (linegroup < 0 ) (bool) $19 = false (lldb) p (-1 < 0) (bool) $20 = true (lldb) p ((int)linegroup < 0 ) (bool) $21 = false (lldb) p ((int)linegroup > 4) (bool) $22 = true (lldb)  

the linegroup variable assigned follows:

- (void)gotlinegroupinformation:(nsstring *)linegroupstring {     nsinteger linegroup = [linegroupstring integervalue];     if(linegroup >= 0)     {         // gets called     }     else     {         // never gets called     } } 

thanks, andy

the lldb issue seem exact same in objective c integer comparison error:

carl norum said in response :

confirmed - it's bug in lldb ir interpreter.

here's link patch fixes it: http://lists.cs.uiuc.edu/pipermail/lldb-commits/week-of-mon-20130520/008569.html


concerning code, tried reproduce bug without succes test:

nsstring *linegroupstring = @"-1"; nsinteger linegroup = [linegroupstring integervalue]; if(linegroup >= 0) {     nslog(@"positive"); } else {     nslog(@"negative"); // log correctly called every time } 

maybe should try debug nslog 1 (in particular value of linegroupstring right after entering function ?).


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -