home.social

Search

327 results for “DocBohn”

  1. CowPi (0.8.2) for avr/mbed_rp2040/rp2040 by Christopher Bohn

    ➡️ github.com/DocBohn/CowPi

    A library for the Cow Pi educational hardware kit.

  2. CowPi (0.8.0) for avr/mbed_rp2040/rp2040 by Christopher Bohn

    ➡️ github.com/DocBohn/CowPi

    A library for the Cow Pi educational hardware kit.

  3. Turns out the mailbox is barely visible in the corner of one of our security cameras. This playback is at 1/4 speed.

  4. I was thinking about FORTRAN's arithmetic-if statement
    `if (expr) linenumber1, linenumber2, linenumber3`

    I think the closest you could get to that in a non-FORTRAN language still in use would be in C with GCC's labels-as-values extension:
    `goto *(result = (expr)) < 0 ? &&label1 : !result ? &&label2 : &&label3;`

    If the original FORTRAN code didn't go spaghetti (and if `expr` is an integer expression), then you could do it with a C switch-case statement (using GCC's or C2Y's case-ranges):
    ```
    switch (expr) {
    case INT_MIN ... -1:
    ...
    case 0:
    ...
    case 1 ... INT_MAX:
    ...
    }
    ```
    or Java's classic switch-case:
    `switch (Integer.signum(expression)) { // use cases -1, 0, 1`

    If there's no fallthrough, then you could use Java's "enhanced" switch-case or Python's match-case:
    ```
    match expr:
    case k if k < 0:
    ...
    case k if k == 0:
    ...
    case k if k > 0:
    ...
    ```

    godbolt.org/z/dx9dr6oKT

    My point? I don't think there is one.

  5. I was thinking about FORTRAN's arithmetic-if statement
    `if (expr) linenumber1, linenumber2, linenumber3`

    I think the closest you could get to that in a non-FORTRAN language still in use would be in C with GCC's labels-as-values extension:
    `goto *(result = (expr)) < 0 ? &&label1 : !result ? &&label2 : &&label3;`

    If the original FORTRAN code didn't go spaghetti (and if `expr` is an integer expression), then you could do it with a C switch-case statement (using GCC's or C2Y's case-ranges):
    ```
    switch (expr) {
    case INT_MIN ... -1:
    ...
    case 0:
    ...
    case 1 ... INT_MAX:
    ...
    }
    ```
    or Java's classic switch-case:
    `switch (Integer.signum(expr)) { // use cases -1, 0, 1`

    If there's no fallthrough, then you could use Java's "enhanced" switch-case or Python's match-case:
    ```
    match expr:
    case k if k < 0:
    ...
    case k if k == 0:
    ...
    case k if k > 0:
    ...
    ```

    godbolt.org/z/dx9dr6oKT

    My point? I don't think there is one.
    #StupidCompilerTricks