Jump to content


The B programming language


7 replies to this topic

#1 CodeCat

    It's a trap!

  • Gold Member
  • 6,111 posts

Posted 01 February 2009 - 11:16

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...
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#2 ΓΛPTΘΓ

    Ecchi Toaster

  • Project Team
  • 923 posts
  • Projects: Spam

Posted 01 February 2009 - 16:16

This sound very hard...

What about /b/ programming language...xD
Posted Image
Posted Image

Awesome radio

Quote

19:44 - Chyros: I'm very harmless

#3 CodeCat

    It's a trap!

  • Gold Member
  • 6,111 posts

Posted 01 February 2009 - 16:23

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|
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#4 ΓΛPTΘΓ

    Ecchi Toaster

  • Project Team
  • 923 posts
  • Projects: Spam

Posted 01 February 2009 - 16:35

LOL nice find... 8|
Posted Image
Posted Image

Awesome radio

Quote

19:44 - Chyros: I'm very harmless

#5 UnderFlow

    Amateur

  • Member
  • 121 posts

Posted 01 February 2009 - 18:54

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. ^^

#6 BeefJeRKy

    Formerly known as Scopejim

  • Gold Member
  • 5,114 posts
  • Projects: Life

Posted 01 February 2009 - 19:18

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?
Posted Image

#7 CodeCat

    It's a trap!

  • Gold Member
  • 6,111 posts

Posted 01 February 2009 - 21:43

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.
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#8 BeefJeRKy

    Formerly known as Scopejim

  • Gold Member
  • 5,114 posts
  • Projects: Life

Posted 01 February 2009 - 23:51

Hehe interesting...
Posted Image





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users