The perfect programming language doesn't exi-

The perfect programming language doesn't exi-

Other urls found in this thread:

msdn.microsoft.com/en-us/library/bb288454.aspx
twitter.com/AnonBabble

Yeah anyone who says C isn't perfect is too stupid to use C

C isn't perfect

C is the perfect langu-

C can't be replaced by any other lang-

C isn't perfect

struct Car c;
init_car(&c);
drive_car(&c);
free_car(&c);


Car c;
c.drive();


which would you rather write?

(create automobile)
(drive automobile)

The former, because at least then what is happening is obvious. Predictable. The latter undoubtedly generates a metric fuckton more assembly, too.

this
/thread

(append '() '(see) '())

Rust is no better at replacing C than any of the hundreds of languages before it, like Go and Java.

Nothing will ever replace C because C doesn't need to be replaced.

We're actually in the process of scrapping legacy C applications at work.
So, yes, it does get replaced.

C was a horrible language even when it was invented.

> anyone who says C isn't perfect is too stupid to use C

...or isn't a cargo-culting retard mindlessly using outdated technology because it's what your Unix heroes were stuck with at the time.

That is just wrong. Java and Go are not meant to replace C, they serve a completely different purpose. They both have Garbage Collection and I'm not sure whether you can run java without the java virtual machine.

>outdated technology
It's not really possible to use any kind of computing device or system in which C isn't involved. It's everywhere. Outdated /= old.

I can read the first one

Replacing it in favour of what?

Java.

Oh yeah, that's why Lisp is used literally everywhere.

Kek.

>takes off leg
>replaces it with a cello

Good fix boss.

Java and Go were meant to replace C++, which was meant to replace C. Intent to replace is transitive.

... but why

Hey, what's going on he-

Because Java is the perfect solution.
- runs on Linux
- plays well with Oracle databases
- easy to read, easy to write, easy to maintain
- proven track record of long-term support and reliability

This is an application that's going to be running 24/7 for months at a time, so we needed something that we were positive was stable enough, and the JVM definitely is.
When discussing the rewrite we pretty quickly narrowed it down to Java and C# (both of which we use in other parts of our portfolio), but since .NET Core is very new (less than a year on Linux) we went Java.

>Oracle databases

why

>easy to maintain
>reliability

Because our databases are Oracle.

C is a system programming language.
C++ is also a system programming language, but is also useful for other things.

Java is not a system programming language. It can replace C and C++ in other tasks, but it's not suitable to write an operating system kernel, or drivers, etc.
It can't replace C in these tasks.

You should scrap that for postgres

Yeah of course if you want to make bussiness applications C is not the best choice. But if you're programming a device or anything that needs hardware use glhf with your shitty Java.

p.s. c# is superior. linq. not eclipse. /thread

C++ failed to replace C.
Java failed to replace a language that failed to replace C.
Go failed to replace a language that failed to replace C.
Rust will fail to replace anything.

java was never meant to replace anything you gay little rat

>mindlessly using outdated technology
literally how?
Tools in a toolbox.

I like writing little system utils in C. They're lightweight and easy to read. Sometimes you don't want a .net runtime, java, python, or ruby installed to do something simple.

You build a car, then you start the engine so you can drive it, and when you're done you turn off the engine. Makes sense to me

>turn off the engine
No, you fucking idiot, you destroy the car. Can't you read? You inbred, you fucking moron.

no, free means you liberated it

do you not like freedom?

>the hammer was invented thousands of years ago
>"Find something else to hit nails with, you retard. The hammer is so outdated."

C is timeless, you dumb faggot. It'll forever be the franca lingua of programming.

Variadic arguments. Clib has a high risk of buffer overflows.

>not having a nail-gun with automatic nail management

t. umblr

C is perfect and never obsol-

is this a c thread

Costly. Requires more maintenance. Prone to breakage, rendering it useless.

Hammer win every time.

>Because java is the perfect solution

but C/C++ fits everything you said about java being "perfect".

Java is babies first programming language.

could someone with no programming experience but myspace html and gta v .ini editing jump right into learning c and get a job?

yes

I doubt it but you dont really know until you try. I would look into another language for getting a job quickly with no experience, something web based, then learn C and go from there.

After reading "The Go Programming Language Phrasebook" I now understand why and accept that Go is better than C.

Back when we had one core C was fine, Go is the modern C made to work with modern hardware.

>And get a job

No. Good luck finding a job for anything serious without an education(and yes I know there are people that still get jobs with portfolios and good programming skills but they are in the minority and are autisticly good at what they do).

Thats not even mentioning the fact that you're looking for a job using C. Only people that still use C AFAIK are embedded system engineers and firmware programmers. Which brings you back to the lack of formal education.

Unless if you want to be some webdev codemonkey making

>Clib has a high risk of buffer overflows
Don't use unsafe functions then. Win32 has replacements for pretty much all of them and I'm sure other platforms do too

I started with C.

Pros:
-it is a language
-it is functional

Cons:
-everything else

there's literally no reason to worship legacy shit

t. started with Java

msdn.microsoft.com/en-us/library/bb288454.aspx

The only place C++ is appropriate is if you need execution speed at any cost, most notably safety.

As a person who has used C for awhile, it is nowhere near perfect.
Alot of the newer features that were tacked on to C later on is very sloppy. Not to mention the code has potential to be spaghetti code easily.

For Example:
-Strings are still arrays of strings with appended null character. It is antiqutated as fuck.
-Using dynamic arrays can basically turn your code into spaghetti code. You need to allocate memory then use arithmetic that looks nothing like arrays to do operations on each cell. Not to mention there are 4 ways to allocate memory and resizing always needs an realloc call. I would almost argue this is just making space in the heap rather than an array.
-So that goes into that there is just way to do the same shit in different ways. In a robust language, this should not be happening.
- (opinion) Pointers are complete bullshit. Tony Hoare that made the whole null pointer/references said it was a mistake.

>no garbage collection
pass

Not to mention:
-Dangling Else problem
-Every problem that comes with pointers (Memory allocation, memory leaks, freeing memory)
No seriously fuck pointers, they cause way too many problems

There's absolutely nothing wrong with null-terminated char arrays.
>You need to allocate memory then use arithmetic that looks nothing like arrays to do operations on each cell.
There's nothing stopping you from creating addressable multi-dimensional arrays.
See >dangling else
any language allows you to write logic errors

Please leave, you get all your knowledge of C from sensationalist websites.

>-Strings are still arrays of strings with appended null character. It is antiqutated as fuck.

...there's nothing wrong with that.

>Using dynamic arrays can basically turn your code into spaghetti code. You need to allocate memory then use arithmetic that looks nothing like arrays to do operations on each cell.

Wut? Give an example.

> Pointers are complete bullshit.

Uh. That's how computers *work*.

C is the lowest-level, cross-platform language for current CPU technology. It's not meant to be easy for humans. It's meant to be the smallest language that supports cross-platform compilation.

the problem is that pointers are unavoidable if you are actually working directly with hardware and programming a computer instead of working inside a higher level abstraction. the cpu needs to work with memory addresses, how else do you propose to do it?

>There's absolutely nothing wrong with null-terminated char arrays.

There is no reliable way to tell if a given char* is a valid null-terminated string. Any check you could possibly write has no way of knowing if it is walking off into someplace else in the heap or uninitialized memory. You are basically banking on the fact that you didn't make an off-by-one error that accidentally cut the terminator off a string. This is 100% unacceptable.

Also, there's that little problem that using null-terminated strings prevents you from having a null byte in the middle of your string for no good reason.

If your string implementation is not an opaque struct that contains the data buffer and an associated length, clean out your desk, you're fired.

... I hope I do not have to explain the difference in memory space between a defined variable compared to an array of characters

>There's nothing stopping you from creating addressable multi-dimensional arrays.
The problem is not nothing is stopping you, but it creates a readability problem for the person maintaining it. If you think that code u listed is more elegant then java or python dynamic arrays, you are delusional

>any language allows you to write logic errors
You have no idea what a dangling else problem is. Great to know. Look it up instead of pretending to know stuff

>Please leave, you get all your knowledge of C from sensationalist websites.
>mfw I actually had to maintain and log c++ code for a company
See above for the first question
>Using dynamic arrays can basically turn your code into spaghetti code. You need to allocate memory then use arithmetic that looks nothing like arrays to do operations on each cell.
See above again
>Uh. That's how computers *work*.

C is the lowest-level, cross-platform language for current CPU technology. It's not meant to be easy for humans. It's meant to be the smallest language that supports cross-platform compilation.
No shit that is how computers work, but should the user really be able to mess with memory space directly? This is why memory leak problems happen in the first place. Why can't they do it via macro by language like the newer languages?
Let the language handle all the semantics?

and how do you implement the language, my dudette? do you have any idea how computers work, and what memory is?

>Rust

>There's absolutely nothing wrong with null-terminated char arrays.
(You)

>You are basically banking on the fact that you didn't make an off-by-one error that accidentally cut the terminator off a string.
>WAAAH C DOESNT LET ME MAKE MISTAKES!!
>Also, there's that little problem that using null-terminated strings prevents you from having a null byte in the middle of your string for no good reason.
If you're dealing with raw memory blocks that aren't strings, use memcpy, memmove, and other memory functions that take a length and don't check for a null.
Or write your own. You should be used to this by now, this is C.

Yes I know I'm being trolled.
Here's some more (You)s for (You), i'm fucking done with this thread.

There have been many ways to do them and the newer languages are still coming up with ways of doing it? Java specifically gives unique memory addresses in the heap and extending the arraylist extends the heap. It is the same thing as doing malloc, and realloc in a readable format. You also do not need to free the memory later on, which could save lines of code due to Java's garbage collection. Although java is not perfect, it was one of the first to have a unique solution to pointers. You can read about it more in other materials, but the field of memory allocation solution is still growing and interesting to read.
If you really have problem with pointers and memory locations, look up lock-and-keys method and tombstones. These were designs specifically made to solve memory leak problems for pointers, but they have their own problems as well.

move along imperitards
i have your perfect language right here

enjoy your segfaults, no concurrency and memory leaks

bask in the glory of the worlds greatest type system and the best compiler even written

uh...what? Also those mistakes can cause a company (honestly again, I don't think you ever worked in the CS field at all since this is obvious knowledge) billions of dollars. Those mistakes are way too easy to make and it happens way too often to nearly everybody. People are human, they could make a simple error like that anytime.

Also why the fuck does a language make you do all that just so the mistake doesn't happen? In-face, who the fuck wants to read all that. I don't know if C cured your mom of cancer or some shit, but it is nowhere near perfect.

>C is a functional programming language
are you high?

>what is golang?

He probably means "it werks" instead of actual functional languages. I have no idea why he put it like that.

kek, I think we broke him.

tombstones and lock&key are methods to make pointers more safe, and incur significant runtime performance and memory usage penalties. java's heap is not the physical heap memory that your pc uses, it's the jvm heap. what was jvm originally written in? oh right, C.

>Functional Langauges
>Perfect

LIKE I said java is not perfect and the flaws come from the JVM as well as advantages (such as portability), but you will rarely have memory leak problems in java compared to C.

>Something was made using an older concept, therefore the older concept is better
...Wut? Do you know how retarded u sound? So what? Java was made to be an improvement over C so yeah, some of the stuff is coded in C.

That book is SHIT

C++

Thank you it is.

the first because then im in control of what happens with initialization as well as destruction, when exactly they happen, not to mention its clearer

>using the you meme invented by /s4s/

kill yourself

replacing bad c code with babby's first language written in c

>See above for the first question

What? What first question? Jesus Christ, learn how to quote. Your string issue? Yeah, it's been established that there's nothing wrong with null-terminated strings.

>See above again

What? See what? Your inability to understand the other guy's example code of how to address multidimensional arrays?

>No shit that is how computers work, but should the user really be able to mess with memory space directly?

Yes. C is appropriate for device drivers and other low-level software where performance is imperative. It is *not* an appropriate language for general application development in 2016.

> Why can't they do it via macro by language like the newer languages?

Da fuq? Do you understand any of the words you're using?

The Intel Management Engine is already capable of running Java applets, even though it's a very low-level system. Eventually everything lower-level than Java or Javascript will be proprietary and locked down by the hardware vendor, leaving third parties with only Java/Javascript to program any higher-level functionality. With enough processing power and RAM even kernels and drivers can be done in Javascript, and that's where we're headed.

>tfw when old beards said C was absolute garbage when it came out, and said that it would set computing back by decades by destroying the lessons we learned from Lisp

>tfw people nowadays praise C for being good

Look how far we've gone back, that the yesterday's horrible junk is today's cream of the crop.
Imagine how far we would have got by now, if Lisp and Genera won the systems programming wars, instead of C.

Yeah, C is still better than most of the stuff we have now, but that's a very low bar to set. We're trampling on the legacy of the greats who preceded us.

No it isn't. It's one of the finest examples of minimalist, easily-comprehensible introduction to a language that's ever written.

Unfortunately, idiots like Zed Shaw pretend it's a general book on how to program, or how to be a software engineer. It's not. And it's *extremely* clear about this.

>even kernels and drivers can be done in Javascript

Put off the drugs, Pajeet.

It's a good language, but perfect? No.

>switch case requiring break
This is stupid. There is no justifiable reason for fallthrough to be the automatic behavior. An examination was done of the source code for I think the Sun Microsystems C compiler and it was found that, even in a compiler, the default behavior was almost used. It was used so infrequently that they actually marked every location where they did it intentionally so people wouldn't think it was a mistake.

>no namespaces
You don't like classes, fine, understandable. But namespaces impose absolutely nothing on final binary and provide immense usability improvements.

>bitwise operator precedence
How often does somebody seriously want to do a bitwise operation on the result of a boolean operator? Almost never. The other behavior is vastly more common and yet not default.

>vague built ins
Why do I need to include a header to actually have a fair idea of how big my ints are? (int32_t vs. int)

>booleans & NULL
...These are in headers instead of being keywords, why?

>no support for output parameters
If we're going to accept that you're not going to have exceptions, which is reasonable, then that means the return value is going to get hijacked as a status code. Why doesn't the language have either A: output parameters or B: a special output parameter to output the status code through to avoid using the actual return for that?

I'm not a big fan of saying functionality should be removed because it could potentially be abused, but in that field there's a whole pile of unpleasant ways to blow your own foot off I haven't even mentioned here, like assignment within conditions and octal literals.

>There is no justifiable reason for fallthrough to be the automatic behavior.

If it's not automatic then it's not fallthrough. How else would you do it, by jumping to the next case via a goto?

C-INTERCAL

Not him, but this is a very real possibility in the future.

When vendors will inevitably start making locked-down processors that can only run managed languages, and give no direct hardware access to the user, kernels will also be built in these managed languages.

With all the hype surrounding cybersecurity, it's only a matter of time before some smart-but-shortsighted guy will pull out a really great CPU of this type, and it becomes standard.

Placing the continue keyword into the case to explicitly request fallthrough. (Or a dedicated fallthrough keyword which appears in Go/Swift).

Literally all your answers are up there and I will not spoonfeed you cause you do not feel like reading

> It is *not* an appropriate language for general application development in 2016.
This is exactly where I agree on, besides that teat-sucking cuck above you that think C is a "perfect" language. Also, I actually work in the field, of course I am going to compare it to general applications compared to hobbyist interests.
> Why can't they do it via macro by language like the newer languages?
>Da fuq? Do you understand any of the words you're using?
macro - a single instruction that expands automatically into a set of instructions to perform a particular task.

By introducing a "fallthru" keyword perhaps? If you actually use fallthrough, you put a comment there anyway if you're reasonable, so as to point out that it's not just that a break was left out by accident. If you need to be explicit anyway when doing fallthrough, then why not being explicit all the way.

>Literally all your answers are up there and I will not spoonfeed you cause you do not feel like reading

I'm done. You're lazy and your arguments are shit.

Stop making others look all over the thread for supposed explanations behind your hand-waving.

>Placing the continue keyword into the case to explicitly request fallthrough.

Yeah, great, now "continue" means two things.

Automatic fallthrough vs explicit "fallthrough" is a meaningless distinction, it's a simple inversion. Only incompetent people make that mistake after CS101.

C is not perfect, but it is ubiquitous

llvm sucks dick