Skip to content

Comment on A nice, little known C feature: Static array indices in parameter declarationsparent

Comments

Well, I might be upset if this were true for all keywords.

    @static @inline @unsigned @int ilog2(@unsigned @int x)
    {
        @for (@unsigned @int i = 0; i < 32; i++)
            @if ((x >> i) == 0)
                @return i;
        @return 32;
    }
I'm a bit dizzy looking at that code, let me sit down for a moment.

I believe the @ is used only by the obj-c keywords and not the ones from C. So it'll be something more like this

    @autoreleasepool{
        for (int index = 0; index < 100; index++){
            int error = [MyObject performSelector:@selector(addCoolFilterToImage:)];
            if (error) {
                return 32;
            }
        }
    }

Yeah, that was kind of my point.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.