General > General Technical Chat
How many people code in C these days, and if so, why?
IanB:
For interest.
Exhibit 1:
--- Code: ---#include <stdio.h>
int main(void)
{
if ("not empty")
{
printf("The string is not empty\n");
}
if ("")
{
printf("The string is empty\n");
}
return 0;
}
--- End code ---
Exhibit 2:
--- Code: ---#include <stdio.h>
int main(void)
{
_Bool empty1 = "not empty";
_Bool empty2 = "";
if (empty1)
{
printf("The string is not empty\n");
}
if (empty2)
{
printf("The string is empty\n");
}
return 0;
}
--- End code ---
Both produce the same output:
--- Code: ---The string is not empty
The string is empty
--- End code ---
This is canonical C, and is how the language is designed to be used, keeping it brief without unnecessary operations or verbosity.
Cerebus:
--- Quote from: coppice on May 10, 2020, 01:05:55 am ---
--- Quote from: IanB on May 10, 2020, 01:00:32 am ---
--- Quote from: Cerebus on May 10, 2020, 12:38:34 am ---C does not have a boolean type.
--- End quote ---
Why do you say this? Which C standard are you considering?
--- End quote ---
C has a boolean type, but the keyword for it is not "boolean" like the example code being referred to.
--- End quote ---
Presactly.
IanB:
--- Quote from: Cerebus on May 10, 2020, 01:16:02 am ---
--- Quote from: coppice on May 10, 2020, 01:05:55 am ---C has a boolean type, but the keyword for it is not "boolean" like the example code being referred to.
--- End quote ---
Presactly.
--- End quote ---
Frankly, this is at the level of a playground argument: "You didn't use proper grammar, so you're wrong! So there!"
I thought we were meant to be adults here?
intmpe:
--- Quote from: Cerebus on May 10, 2020, 12:38:34 am ---
C does not have a boolean type. A C compiler will definitely complain if you try to assign a string (char *) to a non-string type. Many languages will silently cast a floating point type to an integer and vice versa, so that's a odd thing to pick on. And the rant against academic languages is a bit odd given that C does not have its origins in academe, but in Bell Labs.
If you're going to rant about a language a prerequisite is to know the language well enough to know whether you're ranting about the language or ranting about what you imagine the language is.
--- End quote ---
Be careful with that though because back then these large US corporations with operations like Bell used to run like college campuses where a big part of your job was to publish or patent. I worked at Bell labs in NJ 10 years ago. It was half deserted and they were preparing the coffin for it out the front. When K&R wrote C in the late 70's was like the end of that whole era - so it was coming to an end then. You could say the same thing about a lot of US engineering companies. I earlier worked at GE research labs and it was a gloomy place just waiting for someone to drop and axe and write a requiem. They had gotten out of electronics 20 years earlier and had announced internally they would never ever under any circumstance re-enter the field. Profits were dead - they had gone to Japan/HK/TW by the late 70's. Now its China - its been china since the 90's. I was in Japan 20 years ago and could hardly find an appliance made in Japan. It was all coming out of China even then. And now its leaving China slowly even as they have been gearing up - although I suspect they are slowing that spending spree - they already have all the tech they need. At Motorola they used to call that part of the company Motorola University internally and it was a basic research arm. All of it died about 20 years ago - Motorola being one of the last. GE kept the campus open but the allowable work was shit and depressing. Short story is that time period is over, dead and buried. Even at Universities today you would be hard up to do what K&R did because you need to publish fast. Long term projects don't cut it anymore so you get a constant stream of published garbage. Both Universities and Industry are in trouble. Like I said - I did a US masters just for fun - it was complete shit - not even Masters level IMO. Good school. Mostly taught by adjuncts or even professors who could not give a shit about feedback. Even before this virus thing the only time they ever had was to throw your marks on a web page. Usually with no explanation. So its the worst degree I ever did. What was really hilarious was my colleague did a chip at one of the best public unis in the US using the same tool and the same fab company and process that I did 25 years ago as a 3rd year undergraduate. The difference? I actually had it fabed and went in to put it under the microscope when part of it had a problem. What did he get? Nada - they went through the process of the chip design and layout to the point of preparing the package for fab but the school did not actually spend the money to have it fabed. So that's my experience of US universities.
You want to work in a university like research environment in industry now? - I don't know of any US companies but Toyota Research Labs was pretty good and I was getting called by the basic sciences group at Huawei a few months back. It's always where the money, brains and leadership is, and no US company that I know has that. It's all run by private equity and wall street so their view is only a few years at most ahead.
K&R were lucky - they just made the end of the University like heyday at Bell. Assuming the building still stands if you walk into the lobby at Bell the walls are covered with patents from the 50's and 60's. The walls are 50's paneled walnut straight out of an episode of perry mason.
Cerebus:
--- Quote from: IanB on May 10, 2020, 01:20:48 am ---
--- Quote from: Cerebus on May 10, 2020, 01:16:02 am ---
--- Quote from: coppice on May 10, 2020, 01:05:55 am ---C has a boolean type, but the keyword for it is not "boolean" like the example code being referred to.
--- End quote ---
Presactly.
--- End quote ---
Frankly, this is at the level of a playground argument: "You didn't use proper grammar, so you're wrong! So there!"
I thought we were meant to be adults here?
--- End quote ---
There was rather more flawed in the argument put forth than just the spelling of a type name.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version