←  Code Block

Fallout Studios Forums

»

The B programming language

CodeCat's Photo CodeCat 01 Feb 2009

Yesterday I was reading a bit about programming and came across a language called B. It probably doesn't surprise you that it's the predecessor of C. It does look at lot like C (for those of you who know it) but it's a bit... different.

You might be aware that C, as well as other languages such as C++, Java, Visual Basic, Pascal etc all have a selection of variable types (int, float, bool, string etc.), as well as composite types like structs, records and classes. B has NONE of that. In B, all variables are integers, and all functions return int, no exceptions. B does have pointers like C does, but since everything is an integer, the only way to get a pointer to some other variable is to store the address of it in a variable (which of course is an int). And then of course you can dereference it with * like in C, but since B has no types you can dereference ANYTHING. So you can imagine that programming in B is a bit awkward, and certainly not as safe as in most other languages. Some people call C 'platform independent assembly', but I would say B is that even moreso...
Quote

ΓΛPTΘΓ's Photo ΓΛPTΘΓ 01 Feb 2009

This sound very hard...

What about /b/ programming language...xD
Quote

CodeCat's Photo CodeCat 01 Feb 2009

HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
	UP VAR!!1
	VISIBLE VAR
	IZ VAR BIGGER THAN 10? KTHXBYE
IM OUTTA YR LOOP
KTHXBYE


http://lolcode.com/ 8|
Quote

ΓΛPTΘΓ's Photo ΓΛPTΘΓ 01 Feb 2009

LOL nice find... 8|
Quote

UnderFlow's Photo UnderFlow 01 Feb 2009

B is basically the essence of everything I hate about C++. 8|

And lolcode is awesome, but my favorite esoteric programming language is Whitespace, probably the only programming language optimized for saving printer ink. ^^
Quote

BeefJeRKy's Photo BeefJeRKy 01 Feb 2009

Wow that sounds really old! Maybe something used to develop programming languages. What if you needed to make floating point calculations? Can you 'cast' variables as in Java?
Quote

CodeCat's Photo CodeCat 01 Feb 2009

B was designed in 1969, C started off a few years after that. C++ didn't come around till 1986.

B didn't have any casts, since there were no data types. If you wanted to do floating point stuff you were probably screwed, or you had to use some library functions to do it. Back in those days, floating point support was rare anyway. Even on the PC platform, there was no support for floating point operations, and you needed to buy a separate 'math coprocessor' to use floats. The 386DX processor (in 1986) was the first CPU to offer floating point support without needing a coprocessor, but there were still lower-end 386SX and 486SX models which lacked floating point support, and it wasn't until the Pentium (in 1993) that the coprocessor became entirely redundant.
Quote

BeefJeRKy's Photo BeefJeRKy 01 Feb 2009

Hehe interesting...
Quote