HN user

tordek

11 karma
Posts0
Comments16
View on HN
No posts found.

I would like to know the reasoning behind this. It sure seems clever but what is the advantage that this provides?

Since C provides very little metaprogramming capabilities, this was the only way to obtain what I wanted: Most (if not all) other testing libraries/frameworks require some boilerplate to start testing (namely: defining your `main` function, which calls all of your tests). Additionally, every time you write a new test, you must remember to add it to your `main` function.

I decided that those two things were bothersome enough, so I wrote a proof of concept that evolved into a large project with tons of useful features beyond that.

18F API Standards 12 years ago

Would you mind expanding a bit on the usage of Range?

The simplest case involving items is clearly `items=10-20`, but that has its own set of problems (your set must be ordered; I assume you'd use the key you're sorting over as your `ranges-unit`).

The place where this solution seems less than ideal is when you want to start from an id, but get a certain number of items. That is, the "infinite scroll" use case: If you simply do "sort by date, discard 10, return next 10 items", then you have a race condition where you do your first request, a second agent adds a new item, and you do your second request: the last item from the previous page is now the first item from the current page.

So, ideally, I want to request: "Ordered by date, where id > <last-id>, 10 items".

If you're strict about the definitions of `Range`, this doesn't seem possible.

Maybe the best way to do this would be `Range: items=decacfb98eface89+10` or similar?

But that makes no sense, it is whitespace, and it has semantic significance (hence being significant). Whitespace was not significant in older versions of Fortran, and that allowed you to write

    DO30I=10,100
which was interpreted as
    DO 30 I = 10, 100

An amusing bug I saw in Expert C Programming mentioned how somebody once typed e dot instead of a comma, and
    DO 30 I = 10. 100
ended up interpreted as a simple real assignment:
    DO30I = 10.1

As said elsewhere: "Declaration follows use".

    int *foo;
means "foo is a pointer to int". But that's explained different from how it's written. More clearly, you can say that "foo" is an int. Then, doing
    int *foo;
    foo = 50;
is obviously wrong because "foo" is not an int; however
    int *foo;
    *foo = 50;
is correct.

Similarly for arrays:

    int *foo[50];
means "foo is an array of pointers to int", or "
foo[5] is an int".

From there follows that & is the antithesis of , and they negate each other:

    int *foo; //foo is a pointer to int.
    &*foo; //the address of the contents of foo
    foo; // same as above, but shorter.

> Wait are you saying I have to be content with who I am?

When did he ever tell you to stop bettering yourself?

> What do you mean I can't expect my employer to validate my passions in life?

Because your passions are yours, and yours alone. You could get miraculosuly lucky and get an employer that shares some of your passions and lets you work in them... or you could remove chance from the equation and write code on your own, and open source it.

That's the way spanish is pronounced.

Radio is "Rradio".

I've found amusing how some people who learn english as a second language end up pronouncing spanish as "espanish", since no spanish word begis with s(consonant), except for sh.