Live data from Hacker News

Why artificially limit your code to C?

stackoverflow.com

1–10 of 40 posts

Re: Why artificially limit your code to C?

#2
In computing

conservative==industry

liberal==academia

conservative==C

liberal== lisp

I hope Microsoft beats-up Linux because Microsoft is not commies.

I have no problem with C++. I didn't do all of the language in my compiler. Some of it is a wash, some of it very nice, some things foolish.

In industry, you might want to keep it simple, so you can hire a replacement easier. In rare circumstances, you want it easier to make a compiler.

I like to do global find-and-replace string operations across all my files. If a function is named FileRead() and not File::Read(), then I can do replaces or searches.

I am not passionate either way on this topic. I'm not fond of the STL, though.

I don't like the "const" type system. Too many namespaces isn't always better. Is it really always better to alphabetize soup cans in the cupboard when hashing them is okay?

----

to remove it from Ephraim's head unto Manasseh's head.

48:18 And Joseph said unto his father, Not so, my father: for this is the firstborn; put thy right hand upon his head.

48:19 And his father refused, and said, I know it, my son, I know it: he also shall become a people, and he also shall be great: but truly his younger brother shall be greater than he, and his seed shall become a multitude of nations.

48:20 And he blessed them that day, saying, In thee shall Israel bless, saying, God make thee as Ephraim and as Manasseh: and he set Ephraim before Manasseh.

48:21 And Israel said unto Joseph, Behold, I die: but God shall be with you, and bring you again unto the land of your fathers.

Re: Why artificially limit your code to C?

#5

No one there mentions symbol scrambling, and how it makes C++ libraries unportable across multiple compilers for the same platform.

That's what I thought too, until I found that there exists C++ ABI on linux. I tried to link together two small files, both using iostreams, one compiled with Intel C++, the other with g++, and it worked.

Though I'm in doubt [haven't tested it yet] whether it would have worked had I tried to use something std::vector across functions compiled with different compilers.

Re: Why artificially limit your code to C?

#6

> C is small and simple and I can fit the whole language in my brain Except when you see Duff's device for the first time and realize that C you thought you knew what's the actual C :) http://catb.org/jargon/html/D/Duffs-device.html

This was exactly my first thought. C fits in my brain.

On Duff's device. My thought, the first time I saw it, was "brilliant!"

Re: Why artificially limit your code to C?

#7

No one there mentions symbol scrambling, and how it makes C++ libraries unportable across multiple compilers for the same platform.

Everyone loves to bash the lack of a C++ ABI. Now please name another language with native implementations with a standard ABI across different compilers.

C implementations have a standard ABI, because they usually are the operating system ABI.

Re: Why artificially limit your code to C?

#8
post #5

No one there mentions symbol scrambling, and how it makes C++ libraries unportable across multiple compilers for the same platform.

That's what I thought too, until I found that there exists C++ ABI on linux. I tried to link together two small files, both using iostreams, one compiled with Intel C++, the other with g++, and it worked. Though I'm in doubt [haven't tested it yet] whether it would have worked had I tried to use something std::vector across functions compiled with different compilers.

It is less of an issue in linux where there is a healthy ecosystem of libraries where you have access to source code and can reasonably expect to be able to compile everything with the same compiler. (Obviously there are times when this is not practical, but for most cases, it is ok).

Under Windows, the whole situation is a mess.

For current interesting platforms, the problem is often solved by either having no C++ compiler, or just one (e.g. the Qualcomm QDSP, which I think only recently gained a C compiler lacks a C++ compiler, and I don't imagine this changing soon).

Re: Why artificially limit your code to C?

#9

> C is small and simple and I can fit the whole language in my brain Except when you see Duff's device for the first time and realize that C you thought you knew what's the actual C :) http://catb.org/jargon/html/D/Duffs-device.html

Meh, Duff's device works in C++, too. If anything, it's an argument against both languages.

Re: Why artificially limit your code to C?

#10
post #7

No one there mentions symbol scrambling, and how it makes C++ libraries unportable across multiple compilers for the same platform.

Everyone loves to bash the lack of a C++ ABI. Now please name another language with native implementations with a standard ABI across different compilers. C implementations have a standard ABI, because they usually are the operating system ABI.

I'm not sure what you mean here by "name another language". Do you mean other than C? I don't understand what that would demonstrate.
Post reply on HN