Hacker Newsnew | past | comments | ask | show | jobs | submit | ntoslinux's commentslogin

What is the reason for the weird `{ code };` blocks everywhere and is the below code machine generated?

```c ((PageSize) (chunk->pageSize - ((PageSize) ((PageSize) ((PageSize) (sizeof(Page) + (sizeof(struct _Block))) + (PageSize) ((sizeof(double)) - 1u)) & ((PageSize) (~((PageSize) ((sizeof(double)) - 1u)))))) - ((PageSize) ((PageSize) ((PageSize) ((sizeof(FreeBlock) + sizeof(PageSize))) + (PageSize) (((((sizeof(double)) > (4)) ? (sizeof(double)) : (4))) - ```


Worse yet, there's several places with empty code blocks, eg. [0] and [1]. Even without that, the formatting contains so much unnecessary whitespace, newlines, casts, etc; I'm not sure why, given the already massive source file. How do you even fit [2] on a screen?

[0]: https://github.com/xtellect/spaces/blob/422dbba85b5a7e9a209a...

[1]: https://github.com/xtellect/spaces/blob/422dbba85b5a7e9a209a...

[2]: https://github.com/xtellect/spaces/blob/422dbba85b5a7e9a209a...


There's a lot of code in the file that is questionable to say the least. There are unnecessary blocks ( { ... }; ) of code with unnecessary semicolons that don't serve any logical purpose.

My hunch tells me it may be the result of macro-expansion in C (cc -E ...), etc. So it's likely there's a larger code base with multiple files and they expanded it into a one large C file (sometimes called an amalgamation build) and called it a day.

By they, I mean the OP, a script or an AI (or all three).


Exactly my thought... This look like a clean room implementation situation

Thanks for the instructions.

sudo apt update

sudo apt install texlive-latex-extra

sudo apt install dvipdf

sudo apt install ghostscript

sudo apt install texinfo

git clone https://git.savannah.gnu.org/git/c-intro-and-ref.git

cd c-intro-and-ref

make c.pdf

makeinfo --html -v c.texi -o c.html --no-split


With Docker:

  mkdir -p out.d ; chmod 1777 out.d
  docker run --rm -it -v "$(pwd)/out.d:/out.d" \
    debian:latest \
    sh -c "
        apt update && apt install --no-install-recommends -y \
          texlive-latex-extra \
          texlive-base \
          ghostscript \
          texinfo \
          git \
          ca-certificates \
        && git clone --depth 1 https://git.savannah.gnu.org/git/c-intro-and-ref.git \
        && cd c-intro-and-ref \
        && make c.pdf \
        && makeinfo --html -v c.texi -o /out.d/c.html --no-split
    "


With Guix:

    guix shell --pure git texinfo make nss-certs
    [env] $ git clone https://git.savannah.gnu.org/git/c-intro-and-ref.git
    [env] $ cd c-intro-and-ref
    [env] $ make c.info
...and read it in your Info reader; I recommend Emacs (C-u h i /path/to/c RET).

PDF is inferior because it doesn't have a convenient way to access the curated concept or variable index, whereas in Info you can just hit "i" and type something like "array, layout in memory" and jump straight to the relevant paragraph.


I ran these after creating a docker container on my mac.

> docker run -t -i -v $HOME/docker-mounted:/tmp ubuntu /bin/bash

And copy the c.pdf from /tmp in docker to my local mac.


> sudo apt install dvipdf

There's no such package.


I think the package texlive-base or texlive-latex-extra includes dvips (for PostScript), which provides the dvipdf command.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: