Live data from Hacker News

AsmBB – a lightweight web forum engine written in assembly language

asmbb.org

101–110 of 131 posts

Re: AsmBB – a lightweight web forum engine written in assembly language

#101
post #25
post #9

Man how do you even connect to a db with assembly code? Are there assembly libraries? In theory I understand it but the monumental amount of effort it would take to write such “simple” things would take so much time

C is generally first compiled into assembly anyways. When you program in assembly you're basically just doing the job of the compiler, and can call all the same library functions C code can. You just have to follow the calling conventions of the architecture. It's cumbersome and tedious, but nowhere near impossible. x64 made calling functions more annoying by using registers then spilling over into the stack after ex…

> C is generally first compiled into assembly anyways.

Splitting hairs perhaps, but the C compiler output is machine code, right? No reason to generate assembly along the way.

Re: AsmBB – a lightweight web forum engine written in assembly language

#102
post #51

Earlier quoted context omitted.

I disagree; dependencies are more of a liability than anything else.

I can see this maybe being true in a high level language (depending on the dependency), though it's definitely not the case with assembly. OpenSSL, for example, was hit with quite a few serious bugs over the years, and I'd still choose using it than my own SSL implementation. Especially in assembly.

people who are not familiar with cryptography are often unaware of this, but cryptographic algorithms are among the kinds of code most commonly written in assembly

not only are they almost never subject to the kinds of security problems we commonly associate with low-level languages like assembly or c (for example, buffer overflows and heap corruption) they also commonly need to run in constant time to prevent timing side-channel information leaks, and while that is not trivial to achieve in any language, it's more feasible in assembly than in c. also, they are commonly a performance bottleneck, and they commonly need kinds of bit manipulations that c is typically slow at, which rewards assembly implementations

openssl in particular contains about 85000 lines of assembly language, mostly embedded in perl files. (it uses perl as a sort of alternative macro assembler)

Re: AsmBB – a lightweight web forum engine written in assembly language

#103

Earlier quoted context omitted.

> OpenSSL, for example, was hit with quite a few serious bugs over the years, and I'd still choose using it than my own SSL implementation. Especially in assembly. That's the difference between a programmer and a real engineer: an engineer doesn't need any help from dependencies to make his code totally insecure.

Engineers do design, implementation is the job of the technician or machinist or somebody like that. If the engineer’s code ends up shipped to customers, something very strange has happened.

the source code is the design; it plays the same role that schematics or mechanical drawings play for products made by electronic technicians or machinists. the difference is that compilers take the place of technicians or machinists, and that confuses people, often for political/ideological reasons

see jack w. reeves's 'code as design' series, beginning with 'what is software design?' from 01992, for a fuller explanation https://www.developerdotstar.com/mag/articles/reeves_design.... https://www.developerdotstar.com/mag/articles/reeves_origina... https://www.developerdotstar.com/mag/articles/reeves_13years..., and the discussion on wiki https://wiki.c2.com/?TheSourceCodeIsTheDesign=

Re: AsmBB – a lightweight web forum engine written in assembly language

#105
post #25

Earlier quoted context omitted.

C is generally first compiled into assembly anyways. When you program in assembly you're basically just doing the job of the compiler, and can call all the same library functions C code can. You just have to follow the calling conventions of the architecture. It's cumbersome and tedious, but nowhere near impossible. x64 made calling functions more annoying by using registers then spilling over into the stack after ex…

> C is generally first compiled into assembly anyways. Splitting hairs perhaps, but the C compiler output is machine code, right? No reason to generate assembly along the way.

> > C is generally first compiled into assembly anyways.

> Splitting hairs

> > generally

smh

https://en.wikipedia.org/wiki/Compiler#Three-stage_compiler_...

Re: AsmBB – a lightweight web forum engine written in assembly language

#106
post #19

Earlier quoted context omitted.

Oh yeah it's immediately noticeable. How did they do it? https://forum.dlang.org/

Its open source iirc it uses MongoDB and redis for caching, worthy of noting is that you can also browse and download that entire board with a Newsgroups client. It also posts to IRC as well.

It appears to be written in D. It uses SQLite.

https://github.com/CyberShadow/DFeed/blob/master/dub.sdl

Re: AsmBB – a lightweight web forum engine written in assembly language

#107

Earlier quoted context omitted.

> OpenSSL, for example, was hit with quite a few serious bugs over the years, and I'd still choose using it than my own SSL implementation. Especially in assembly. That's the difference between a programmer and a real engineer: an engineer doesn't need any help from dependencies to make his code totally insecure.

Engineers do design, implementation is the job of the technician or machinist or somebody like that. If the engineer’s code ends up shipped to customers, something very strange has happened.

What industry are you from?

Re: AsmBB – a lightweight web forum engine written in assembly language

#108

“In addition it supports Unicode Emoji characters in really native way.” I wish it would go into greater detail here. I’m unclear what “really native” implies, as opposed to some sort of “kind of native” way?

It seems that AsmBB has absolutely no Emoji processing in its asm code, so it's more or less pass-through. Realtime chat does have emoji highlighting in its JS code (a part of the template) though:

    function formatEmoji(text) {
      var emojiRegEx = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g;
      return text.replace(emojiRegEx, '$1');
    }
This probably meant to catch U+00A9, U+00AE, U+2000..3300 and U+1F000..1FBFF, which is by itself too broad, but also the regex itself is not a faithful translation. (If anyone is wondering the correct solution, just use emoji-regex [1] or more recent `/\p{RGI_Emoji}/v` pattern [2].)

[1] https://unpkg.com/browse/emoji-regex/index.js

[2] https://caniuse.com/mdn-javascript_builtins_regexp_unicodese...

Re: AsmBB – a lightweight web forum engine written in assembly language

#109
post #55

Earlier quoted context omitted.

This isn't a problem in practice because C++ developers are expected to know the rules of their language and respect them.

I think you meant "in theory" instead of "in practice" :)

I'm certain "in practice" was intentional, after all this seems to be what C++ compiler developers expect :-P

Re: AsmBB – a lightweight web forum engine written in assembly language

#110

Earlier quoted context omitted.

> Of course assembly language has zero memory safety or other guarantees which probabilistically increases risk. I can't say if I think they balance out one way or the other. I would posit that assembly + Linux kernel ABI is safer than the traditional C/C++ stack because they are not littered with nearly as much "undefined behavior". Signed arithmetic overflows and underflows as expected. Memory allocation with mmap…

This isn't a problem in practice because C++ developers are expected to know the rules of their language and respect them.

> C++ developers are expected to know the rules of their language and respect them

In the same way children are expected to respect fire :-P

Post reply on HN