Bournegol – Algol-like dialect of C used to write the original Bourne shell
1–10 of 10 posts
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#2 #define LOBYTE 0377
#define STRIP 0177
#define QUOTE 0200
I can deal with preprocessor abuse but octal crosses the line...Also, in case anybody would have the bad idea to take inspiration from that code, don't do that:
#define MAX(a,b) ((a)>(b)?(a):(b))
It evaluates the macro parameters twice.Although, on second thought, don't do anything like that code anyway.
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#3I thought it was amusing until I read that: #define LOBYTE 0377 #define STRIP 0177 #define QUOTE 0200 I can deal with preprocessor abuse but octal crosses the line... Also, in case anybody would have the bad idea to take inspiration from that code, don't do that: #define MAX(a,b) ((a)>(b)?(a):(b)) It evaluates the macro parameters twice. Although, on second thought, don't do anything like that code anyway.
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#4I thought it was amusing until I read that: #define LOBYTE 0377 #define STRIP 0177 #define QUOTE 0200 I can deal with preprocessor abuse but octal crosses the line... Also, in case anybody would have the bad idea to take inspiration from that code, don't do that: #define MAX(a,b) ((a)>(b)?(a):(b)) It evaluates the macro parameters twice. Although, on second thought, don't do anything like that code anyway.
Octal was far more common than hex back then, due to machines with a wordsize that was a multiple of 3 bits; hence Unix permissions, coming from the 18-bit PDP-7, also inheriting that convention.
I thought permissions were given in octal just because they're groups of 3 bits (owner/group/other) so it aligns with octal correctly.
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#5Then again, for short academic programs it probably won't cause that much confusion, having running code is more a side-effect of that, so it's a bit like executable pseudocode.
It does make me wonder what's the biggest program out there that's been written with heavy preprocessor abuse. Then again, not sure whether I'd really wanna know…
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#6Earlier quoted context omitted.
Octal was far more common than hex back then, due to machines with a wordsize that was a multiple of 3 bits; hence Unix permissions, coming from the 18-bit PDP-7, also inheriting that convention.
Interesting, you have a source for that? I thought permissions were given in octal just because they're groups of 3 bits (owner/group/other) so it aligns with octal correctly.
PDP-1 18 bit
PDP-2 24 bit
PDP-3 36 bit
PDP-4 18 bit
PDP-5 12 bit
PDP-6 36 bit
PDP-7 18 bit
http://en.wikipedia.org/wiki/PDP-7"In 1969, Ken Thompson wrote the first UNIX system in assembly language on a PDP-7, then named Unics as a pun on Multics"
CDC "super" computers also had 60-bit words.
Moreover, the original ASCII standard had the 7-bit characters, the improvement over even less bits used for characters before that (6 bits == 2 octal digits). 8-bit bytes weren't something you could expect except when buying IBM (which had EBCDIC, not ASCII).
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#7 #define TRUE (-1)
#define FALSE 0
instead of #define TRUE (1==1)
#define FALSE !TRUE
edit: re-formattingRe: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#8Earlier quoted context omitted.
Octal was far more common than hex back then, due to machines with a wordsize that was a multiple of 3 bits; hence Unix permissions, coming from the 18-bit PDP-7, also inheriting that convention.
Interesting, you have a source for that? I thought permissions were given in octal just because they're groups of 3 bits (owner/group/other) so it aligns with octal correctly.
Re: Bournegol – Algol-like dialect of C used to write the original Bourne shell
#9Wonder the rational for #define TRUE (-1) #define FALSE 0 instead of #define TRUE (1==1) #define FALSE !TRUE edit: re-formatting