[racket-dev] scheme_is_list?
On Wed, Sep 7, 2011 at 6:18 PM, Danny Yoo <dyoo at cs.wpi.edu> wrote:
> I'm looking at scheme_is_list in src/list.c, and it looks like there's
> code that's unreachable, unless I'm reading it wrong?! The body is:
>
>
> int scheme_is_list(Scheme_Object *obj1)
> {
> Scheme_Object *obj2;
> int flags;
>
> if (SCHEME_PAIRP(obj1)) {
> flags = SCHEME_PAIR_FLAGS(obj1);
> if (flags & PAIR_FLAG_MASK) {
> if (flags & PAIR_IS_LIST)
> return 1;
> else
> return 0;
> }
Notice there is no else here. So if you would go there, then you'd
drop through outside of the whole if
> } else if (SCHEME_NULLP(obj1))
> return 1;
> else
> return 0;
because the above if is one C expression
And so you'd start running down here
>
> obj2 = obj1;
>
> /** more code here */
> }
>
>
> Isn't all the code starting from 'obj2 = obj1' unreachable?
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/dev
>
--
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay
"The glory of God is Intelligence" - D&C 93