[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

The perfect programming language doesn't exi-

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 203
Thread images: 23

The perfect programming language doesn't exi-
>>
Yeah anyone who says C isn't perfect is too stupid to use C
>>
C isn't perfect
>>
File: Common-LISP-Touretzky.jpg (33KB, 318x400px) Image search: [Google]
Common-LISP-Touretzky.jpg
33KB, 318x400px
C is the perfect langu-
>>
File: 1481153076012.png (101KB, 600x600px) Image search: [Google]
1481153076012.png
101KB, 600x600px
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?
>>
>>57904567
(create automobile)
(drive automobile)
>>
>>57904567
The former, because at least then what is happening is obvious. Predictable. The latter undoubtedly generates a metric fuckton more assembly, too.
>>
>>57904463
this
/thread
>>
(append '(>>57903762) '(see) '(>>57904286))
>>
>>57904463
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.
>>
>>57905320
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.

>>57903820
> 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.
>>
File: 1461403575549.png (24KB, 200x200px) Image search: [Google]
1461403575549.png
24KB, 200x200px
>>57905220
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.
>>
>>57905394
>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.
>>
>>57904567

I can read the first one
>>
>>57905337
Replacing it in favour of what?
>>
>>57905535
Java.
>>
>>57904286
Oh yeah, that's why Lisp is used literally everywhere.
>>
>>57905560
Kek.

>takes off leg
>replaces it with a cello

Good fix boss.
>>
>>57905465
Java and Go were meant to replace C++, which was meant to replace C. Intent to replace is transitive.
>>
>>57905560
... but why
>>
File: Sniper.jpg (160KB, 1024x768px) Image search: [Google]
Sniper.jpg
160KB, 1024x768px
>>57903762
Hey, what's going on he-
>>
>>57905595
>>57905603
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.
>>
>>57905695
>Oracle databases

why
>>
File: 1270323879286.gif (2MB, 290x260px) Image search: [Google]
1270323879286.gif
2MB, 290x260px
>>57905695
>easy to maintain
>reliability
>>
>>57905721
Because our databases are Oracle.
>>
>>57905602
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.
>>
>>57905744
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
>>
>>57905777
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.
>>
>>57905920
java was never meant to replace anything you gay little rat
>>
>>57905394
>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.
>>
>>57904567
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
>>
>>57907035
>turn off the engine
No, you fucking idiot, you destroy the car. Can't you read? You inbred, you fucking moron.
>>
>>57907141
no, free means you liberated it

do you not like freedom?
>>
>>57905394
>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.
>>
>>57903762
Variadic arguments. Clib has a high risk of buffer overflows.
>>
>>57907254
>not having a nail-gun with automatic nail management
>>
>>57904922
>>57904463
t. umblr
>>
File: 1480010823227.png (62KB, 1385x1557px) Image search: [Google]
1480010823227.png
62KB, 1385x1557px
C is perfect and never obsol-
>>
File: cthread.jpg (235KB, 898x1146px) Image search: [Google]
cthread.jpg
235KB, 898x1146px
is this a c thread
>>
>>57907313
Costly. Requires more maintenance. Prone to breakage, rendering it useless.

Hammer win every time.
>>
>>57905695
>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?
>>
>>57909616
yes
>>
>>57909616
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.
>>
File: UE2gQ5n.jpg (3MB, 3600x2400px) Image search: [Google]
UE2gQ5n.jpg
3MB, 3600x2400px
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.
>>
>>57909616
>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 <50k a year. Then your chances are alot better.
>>
>>57907300
>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
>>
>>57903762
I started with C.

Pros:
-it is a language
-it is functional

Cons:
-everything else

there's literally no reason to worship legacy shit
>>
>>57909836
t. started with Java
>>
https://msdn.microsoft.com/en-us/library/bb288454.aspx
>>
>>57909585

The only place C++ is appropriate is if you need execution speed at any cost, most notably safety.
>>
>>57903820
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.
>>
>>57903762
>no garbage collection
pass
>>
>>57910024
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
>>
>>57910024
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 >>57893778
>dangling else
any language allows you to write logic errors

Please leave, you get all your knowledge of C from sensationalist websites.
>>
>>57910024
>-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.
>>
>>57910024
>>57910071
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?
>>
>>57910116
>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.
>>
>>57910116
... 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
>>57910130
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?
>>57910216
Let the language handle all the semantics?
>>
>>57910240
and how do you implement the language, my dudette? do you have any idea how computers work, and what memory is?
>>
>>57904463
>Rust
>>>/lgbt/
>>
>>57910116
>There's absolutely nothing wrong with null-terminated char arrays.
(You)
>>
>>57910236
>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.
>>
>>57910256
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.
>>
File: haskell-logo.jpg (25KB, 431x172px) Image search: [Google]
haskell-logo.jpg
25KB, 431x172px
>>57903762
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
>>
File: Screenshot_2016-12-09_00-19-59.png (121KB, 852x631px) Image search: [Google]
Screenshot_2016-12-09_00-19-59.png
121KB, 852x631px
>>57910285
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.
>>
>>57909836
>C is a functional programming language
are you high?
>>
>>57903762
>what is golang?
>>
>>57910410
He probably means "it werks" instead of actual functional languages. I have no idea why he put it like that.
>>
File: 1480802874096.gif (369KB, 460x334px) Image search: [Google]
1480802874096.gif
369KB, 460x334px
>>57910285
kek, I think we broke him.
>>
>>57910322
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.
>>
>>57910392
>Functional Langauges
>Perfect
>>
>>57910451
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.
>>
>>57903762
That book is SHIT
>>
>>57905535
C++
>>
>>57910529
Thank you it is.
>>
>>57904567
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
>>
>>57910285
>>57910275
>using the you meme invented by /s4s/

kill yourself
>>
>>57905337
replacing bad c code with babby's first language written in c
>>
>>57910240
>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?
>>
>>57905595
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.
>>
File: 1406864826446.png (11KB, 470x454px) Image search: [Google]
1406864826446.png
11KB, 470x454px
>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.
>>
>>57910529
>>57910538

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.
>>
>>57910646
>even kernels and drivers can be done in Javascript

Put off the drugs, Pajeet.
>>
>>57903820
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.
>>
>>57910688
>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
>>
>>57910673
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.
>>
>>57910707
Placing the continue keyword into the case to explicitly request fallthrough. (Or a dedicated fallthrough keyword which appears in Go/Swift).
>>
>>57910635
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.
>>
>>57910707
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.
>>
>>57910735
>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.
>>
>>57910731
>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
>>
>>57904463
llvm sucks dick
>>
>>57910764
>Lazy
>When the guy wants to get spoonfed.
lolk
>>
>>57910729
That scenario would be a complete and insane nightmare.

Anyway, Stallman recommends not to even use anything past the Core 2, so not that it would matter anyway.
>>
>>57904286

I love scheme but it's fucking unreadable
>>
>>57910729
They did that with Fortran on IBM computers and People got tired of their bullshit and made their own computer language. Doubt that will happen again.
>>
>>57910816
I agree with Stallman on that, but Intel doesn't still produce Core 2 chips, and all those machines will be non-operational at some point.

I still have an ancient dell tower with a pentium 4, tucked away somewhere. It won't last much longer though, and neither will Core 2 processors, or similar AMD ones.

>>57910816
>>57910832
From my point of view, there MUST be cheap, nano-level chip fabrication machines built in the future. It is the only way we can guarantee that researchers and hobbyists can still produce their own open and unencumbered processors.
>>
>>57910782
I'm not a big fan of using continue either, I would prefer an explicit fallthrough keyword.

>Automatic fallthrough vs explicit "fallthrough" is a meaningless distinction
No it isn't. With explicit fallthrough the language will automatically do the desired behavior in 95% of cases, removing the opportunity for user error.

Oh I thought of some more too, not really rather minor complaints but still, hardly "perfect".

>inline specifier
Would be nice to have. I mean, the language has the register keyword, don't try to pull any shit about it being redundant or not seeing much use.

>typedef struct {} Blah;
There is no excuse for this nonsense. C++ got rid of it and I don't think there is a single compelling argument why it should have stayed.

>casts for braced initializer lists
I can't actually think of an occasion where this clarifies anything that the type being assigned wasn't already clarifying.
>>
>>57910871
>From my point of view, there MUST be cheap, nano-level chip fabrication machines built in the future. It is the only way we can guarantee that researchers and hobbyists can still produce their own open and unencumbered processors.
Yeah, they are called AMD processors. No, but in all honesty if companies will fill the void for the money. They have no reason not to.
>>
>>57910923
But these fabrication machines cost exorbitant amounts of money, and companies buying these machines will be forced to "innovate" to recoup their investments on manufacturing plants and pay engineers, which will inevitably lead to closed, complex systems all over again.

Maybe a service should exist, to send in your schematics, have the CPU built someplace, and mail you a real CPU for a small fee, but there are problems with this approach as well. How do we know that the service hasn't tampered with your CPU?

Until there's a machine that costs less than five digits that my autistic cousin could put in his room and print out a couple open ARM processors with, the future of open computing doesn't look too bright.
>>
ITT: Ctards and Pyfags too dumb to use pure functional languages
>>
>>57910963
Doubt it, CPUs are extremely complex systems. Basically it is filled with microscopic transistors (according to moore's law) and they keep getting smaller every 10 yrs. No way in hell someone could make that without a sophisticated machine.
>>
>>57910966
>no mutable state
>>
>>57910966
Get off your high horse anon. Functional languages were made for a very specific purpose than conventional programming. Hell if ppl wanted to they could probably learn it since the guy who made the concept of functional languages didn't make the first compiler because the concept of it was so easy to understand people just made their own compilers for it.
>>
Am I bad for doing psudeo object oriented programming in C? Im not dealing with polymorphism though, it's ugly.
>>
>>57910688
>switch case requiring break
every language that matters does it this way
>>
>>57911141
...Because they copied it from C. That doesn't make it a good design choice.
>>
>>57911141
Even if that were true, it doesn't make it a good idea.
>>
>>57910782
>Yeah, great, now "continue" means two things.
>implying that "static" doesn't mean two things
>implying that almost all symbols used for operators don't mean at least two things if not more
>>
>>57911163
switch cases are drop down lists,
you only use them if you want to catch multiple cases to do the same thing.
>>
>>57911124
If you're using encapsulation, then no.
If you're using inheritance, then yes.
>>
>>57911053
>wanting to launch missiles
>>
>>57911124
Strong and easy polymorphism is THE reason to use OOP.
>>
>>57910646
>>57910729

>tfw hardware vendors use their own proprietary and classified macroassemblers to implement anything hardware related
>anyone trying to leak or reverse-engineer it is promptly pinpointed by the {{Botnet(tm)}} and his {{self}}-driving car has an "accident" very soon
>everyone else is restricted and confined to use Java or Javascript as that's the only thing the locked-down hardware will expose interfaces for and work with
>>
>>57910923
Ayymd have their own counterpart to Intel's ME since at least 2013.
>>
>>57911038
This. DIY CPUs with any reasonable (from today's point of view) performance are within the realm of fantasy.
>>
File: cgirl.png (769KB, 1052x1342px) Image search: [Google]
cgirl.png
769KB, 1052x1342px
>>57910024

He said it was HIS mistake. He's essentially apologizing for being Oppenheimer when he was no such thing. From a formal perspective a null reference is perfectly accountable for since in essence,

0 -> null


He's right in that it's cost a lot of damages but that's largely due to incompetency.

You could probably make the argument on his behalf that the null reference has forced people to review their codebase extensively. So it has possibly also saved billions of meme money too.
>>
>>57911263
As far as encapsulation goes, At most I use the Get And Set functions.
>>
>>57910451

The JVM is irrelevant, like he said the concept is sound. Fortran for example didn't always have memory pointers etc

C is great but you definitely don't NEED pointers whatsoever. As a logical concept it's trivial to hide the use of pointers.
>>
>>57911310
Shouldn't NULL be an out-of-band value that's outside the actual valid memory address space, just like EOF is designed to be outside the valid value range (so as not to be aliased with any valid value)?
>>
File: animugirlsippingintensely.jpg (91KB, 614x673px) Image search: [Google]
animugirlsippingintensely.jpg
91KB, 614x673px
>>57910236

>If you don't use Java clean out your desk
Shill harder

>char*
If your program is relying on an accurate pointer then you're terrible to start with.

>off-by-one error
An error that formal design methods and functional programming were MADE to counteract.

If you're not drawing up a formal program specification for important operations in your software then clean out your desk, you're fired.
>>
File: java.jpg (115KB, 1200x1198px) Image search: [Google]
java.jpg
115KB, 1200x1198px
>>57903762
C isn't perfect by any means

>>57904463
Rust is too young for any practical use

>>57904567
The former works fine for most use cases, but there are also ways to work around this.

You can use:
typedef struct Car
{
int x, y, z;
} Car;


instead of:
struct Car
{
int x, y, z;
};


To get around the 'struct' prefix, in order to make it a bit more like C++.
It's more to type, but if that's a problem for you then learn to type faster you fuckin dumbass.

Additionally, you can implement things like
std::vector
in C very easily,
should you need even MORE simplification than what you've already described.

>>57905695
>runs on Linux
C/++ works perfectly on Linux.
The shit you guys used w/ Microsoft must've been their own bastardization of C.

>easy to read, easy to write
Enjoy your
PooHandlerManagerFactoryProxyToolKitDebuggerManagerUtils.java
which extends
HandlerManagerFactory
(which extends
ManagerFactory
) and implements
FactoryProxy, ToolKit, Debugger, Manager, UtilityClass
meme

>>57908289
Fuck off

>>57910038
Fuck off
>>
>>57905744
Well, it's good.
But pour one out for the people using DB2.
>>
>>57910392
>no concurrency

We are not in the stone ages anymore.
>>
god I hate corporate cucks constantly shilling Java
>>
>>57911438

From an axiomatic semantics point it should be treated as a char but at no point should there be a reference to it. Either by value or by reference. If your do-loop or while loop successfully terminates.

From a semantics perspective C strings should be

const f : array [0 .. N) of chars
=> ∀i : 0 <= i < N-1 : f.i


We could make NULL out-of-band but there's no need to if we just spec the program well to start with.

If anything a null helps identify where a program is poorly spec'd
>>
>>57911221
Or if you want to explicitly tell the compiler that you want to use a jump table rather than actual comparisons... Just maybe...
>>
>>57911852
Except I was talking about the NULL pointer and not the NUL char which terminates strings.

>a one 'L' NUL, it ends a string
>a two 'L' NULL points to no thing
>but I will bet a golden bull
>that there is no three 'L' "NULLL"
>>
I have an idea for a better programming language than C, for the workings behind it, it would end up behaving very automated, with data types automatically compatible, there wouldn't be any commands either, it would be mostly GUI based, and these properties come intrinsically with its structure, I've not retardedly wasted huge amounts of computing power on these, it should also have performance like machine code, I think C was a complete step in the wrong direction, best described as making higher functions out of smaller ones, whereas we should have been building small ones up to build big ones (jibberish if you don't understand the concept), if anybody is interested in helping me reply here and I'll give you my email,

A practical example could be developed on processors today however more specialised hardware would improve performance alot
>>
>>57903762
C fanboys, evaluate this expression:
A == B ? C : D
>>
Would I be fine learning C++ first?
>>
>>57911999

It doesn't matter, in all cases they equate to 0 anyway. Which going back to the original point I made with formal methods we can prove that we can program around the value zero by providing program specifications.

http://stackoverflow.com/questions/1296843/what-is-the-difference-between-null-0-and-0

http://stackoverflow.com/questions/176989/do-you-use-null-or-0-zero-for-pointers-in-c/1234382

Regards it being more like EOF? If that's what you're suggesting yes that would probably help but that's a massive design undertaking. I wouldn't think there'd be any unforeseen consequences of making it like that but it's hard to know these things.

So you could do that or you could simply force people to write better programs.
>>
>>57912233

if( A == B) {
return C;
else
return D;
}
return -1;
>>
>>57912526
lolno
== (and most other things) have a higher precedence than the ternary operator. It's "if B, A and C, otherwise A and D."
Gotta love those 15 fucking levels of precedence, some of which are right to left and others left to right for order of operations within those precedence levels!
>>
>>57912233
I don't get what you mean by this.
It's just a ternary operator. There is nothing special going on here.
>>
>>57912570
>== (and most other things) have a higher precedence than the ternary operator
Yes, and?
>It's "if B, A and C, otherwise A and D."
It's "if A equals B, then C, else D.
>Gotta love those 15 fucking levels of precedence
Most C-like languages have around 15. Also (excluding bitwise operators, which everybody agrees is stupid), they are mostly intuitive.
>some of which are right to left and others left to right
All of the right-to-left ones appear on the left side of the thing they work on, so it makes no sense to have them left-to-right.

What supposedly "great" language do you come from that apparently has such simple operator precedence.
C's operator precedence is about as complicated as ever other mainstream language, including non C-like ones.
>>
File: 567467.jpg (10KB, 211x212px) Image search: [Google]
567467.jpg
10KB, 211x212px
>9 > 7 > 5
>returns false
>>
>>57912233
is A==B True ?
Yes then C
No then D
>>
>>57912709
Most languages do this, or even give a compiler error for that.
>>
>>57912766
Most statically typed languages do not cast booleans to integers without special instruction from programmer to do so.
>>
>>57904567
(Car a) => drive :: a -> a
drive car = updateCarPos car


drive(X,Y) :- sameCar(X,Y), moveforward(Y, 10).
?- drive(myCar, Y).
Y= myDrivenCar ;


which would you rather write?
>>
>>57912789
In C, booleans ARE integers.
>>
>>57904567
Both are valid C code.
>>
>>57904858
>The latter undoubtedly generates a metric fuckton more assembly, too.
Completely wrong, you obviously have never looked at the assembly output of a C++ class.
>>
>>57912830
Yes, and that is retarded.
>>
>>57910923

Services like this do exist already to a point. Can't you do some of this stuff with an fpga
>>
>>57903762
I dreamed of the perfect programming language, it's basically Python with brackets something like that:

# This program adds up integers in the command line
import sys
try {
total = sum(int(arg) for arg in sys.argv[1:])
print 'sum =', total
} except ValueError {
print 'Please supply integer arguments'
}
>>
>>57912577
It's an expression which has a certain value dependent on the values of A, B, C, and D.

Let's consider them booleans such that they for the four bits of a 4-bit number, A representing the most and D the least significant bit. In that case, the expression is equal to 1 if the operands (treated as a 4-bit number as per the above) are 0x0, 0x2, 0x4, 0x5, 0x9, 0xB, 0xE, and 0xF, and 0 otherwise.
>>
>>57910038
LUL
>>
>>57913116

>depending on the values A, B, C and D
nigga what
https://en.wikipedia.org/wiki/%3F:#C

What you're describing is not a ternary operation. You can't use more than 3 arguments in a ternary operation so I have no idea where you're getting this example from.

In this case we all assumed it was 'A' '==' and 'B', C and D are just conditionals.
>>
>>57913409

sorry not conditionals I mean output
>>
>>57904922
/thread
>>
>>57912796
What's the last language?
>>
>>57912796
neither, because both langs suck
>>57913871
prolog
>>
Hey guys,

Let's say I've got some graph theory data structure, which type should I use for node ID key, unsigned int or string?

My code is currently using string, but I'm thinking about changing that for int.

My professors wants C++, can't change that.
>>
>>57903762
Golang.
>>
>>57910729
>javascript used for anything of actual importance
jesus christ anon you're going to make me puke
>>
>>57903762

There is no silver bullet, but the best pair of languages is unironically C + Ruby.

1. In Ruby you can easily use inline C, which means you can use inline Assembly. You can also directly use C classes.

2. Ruby does everything Web related, scripting tasks and rapid prototyping. C does everything where you need speed and more "raw power".


I rest my case here.
>>
>>57916060
Surely you meant to say Cython.
>>
>>57917397
Cython's not that great.
>>
>>57911728
ur gay lol
>>
>>57917836
fuck you 8===D
>>
>>57912851
the second one will result in a segfault pham
>>
>>57913092
>perfect language
>exceptions
>>
File: image.jpg (457KB, 2591x554px) Image search: [Google]
image.jpg
457KB, 2591x554px
Yeah fuck all of that multi-threaded nonsense
>>
File: homer at the bat.png (472KB, 444x758px) Image search: [Google]
homer at the bat.png
472KB, 444x758px
>>57904567
The first car is free, so I'm saving money :^)
>>
>>57904567
Car c;

memset(&c, 0, sizeof c);
c.horse = 9000.0f;
c.displace = 2800.0f;
c.mass = 21772.4f;
c.tunefn = tunefueleff;
c.gears = 6;
memcpy(&c.ratios, &niceratios, sizeof c.ratios);
c.tyres = MichelinWhatever;
c.sound = registersound("sound/VROOM.wav");

drive(c);


sometimes you just want to write code that does something rather than writing Class-Oriented Programming boilerplate

by the way, Alef was a nearly perfect language and a worthy successor of C even though it had to be shelved, and nowadays Go carries Alef's torch quite well
>>
>>57919336
it's more like
struct car c;
car_init(&c);
car_drive(c);

or
struct car c;
car_init(&c);
car.drive(c);


whichever you prefer
>>
>>57919645
The one that doesn't inexplicably group functions inside types.
>>
>>57905220
>comparing managed languages to C
you clearly know what you're talking about
>>
File: wikipedian_protester.png (26KB, 100x100px) Image search: [Google]
wikipedian_protester.png
26KB, 100x100px
>>57910648
>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
{{Citation needed}}
>>
>>57919940
Most C programs are not, in fact, operating systems.
>>
>>57910427
Probably because he's a dumb piece of shit poo in the loo and doesn't even know any programming paradigm other than oop.
>>
>>57905502
It's like saying all cars use wheels, so if you can't make your own wheel, you can't call yourself a driver. It's retarded, C is deprecated and using barebones C in 2016 you should question your life choices, unless you're a first year SE/CS student or a dinosaur math professor I've encountered on multiple occasions who uses nothing but C for their calculations.
>>
File: god_kek.jpg (3KB, 112x125px) Image search: [Google]
god_kek.jpg
3KB, 112x125px
>>57919999
Kek has spoken
>>
JAVA is perfect, niggers!
>>
>>57911263
>>57911277
Ive been doing this lately
Game *Game_New(bool init)
{
Game *game = malloc(sizeof(*game));

if (!game)
{
return NULL;
}
else if (init)
{
Game_Init(game);
}

return game;
}

void Game_Init(Game *self)
{
self->running = true;
self->screen = Screen_New(true);
self->input = Input_New(true);
}

void Game_Update(Game *self)
{
Screen_Update(self->screen);
Input_Update(self->input);
}

void Game_ShutDown(Game *self)
{
Input_ShutDown(self->input);
Screen_Shutdown(self->screen);
free(self);
}
>>
>>57922437
>Screen_Update(self->screen);
>Input_Update(self->input);
Stop right there.

It's:
frame:
busy-wait if limiting framerate;
poll input;
render;


By the way, yours is how normal C code is written. There's nothing "pseudo-OOP" about it unless you count calling your Game* arguments "self" instead of "g".
>>
>>57922603
I know that, I was just showing a shorter example then what I really have, Also as far my not being "pseudo-OOP", I would disagree since most C Ive seen written is using globals all over the place. There is no passing of the object as variable at all.
>>
>>57910038
>pass

hey that's not a valid keyword in C. go back to Python
>>
>>57921594

JAVA is far from perfect.

- checked exeptions, WTF ?!?!
- OOP language, yet data tyes are not objects but "primitives"
- you have to use getters and setters everywhere, yet there is NO SHORTCUT for this boilerplate mess

The only way to use Java is by using an intelligent IDE which protects you from the most retarded stuff.
>>
>>57908289
syntactic sugar with mutexes on top of c
>>
>>57919999
You don't understand, anon is the citation.
>>
>>57922904
>- checked exeptions, WTF ?!?!
But this is a good thing?

>- OOP language, yet data tyes are not objects but "primitives"
While I agree, primitives are implicitly cast to their corresponding object types on demand. So this is really not an issue other than a discussion on semantics.

>you have to use getters and setters everywhere
No, you don't have to do this at all. Encapsulation is not mandatory.
>>
>>57922780
C programmers just like to follow the path of least resistance. The convenience of one approach versus the other depends on the significance of the struct.

If it's a single-instance, "big" struct (probably a "singleton" in faggot parlance) then it will probably be made global (static) at the top of the file for easy access from all functions in that file, many of which are likely to access it.

On the other hand, a "little" struct, where there can be an arbitrary number of instantiated structs of that type, should be the argument of functions specifically written just to manipulate it.

In your example a Game would very likely be a "big" struct because there's probably only one instance, and it's probably accessed by many functions that aren't specific to that type.

Compare that to the habits of a C++ programmer, who would invariably think that hiding every member of Game behind a get method is a great idea, or something.

>>57922961
>But this is a good thing?
Stop it.
>>
>>57904567
>fucking typedefs, how do they work?

>>57910236
>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.
O(n+logn) storage requirements considered harmful

>>57910574
(you)

>>57910646
>With enough processing power and RAM even kernels and drivers can be done in Javascript, and that's where we're headed.
With enough time and money even smartphone apps and AAA games can be done in INTERCAL, but that doesn't mean it's a good idea.

>>57910688
>You don't like classes, fine, understandable. But namespaces impose absolutely nothing on final binary and provide immense usability improvements.
You can always give your functions procedurally generated names and access them through human-friendly names using function pointers stored in singleton structs.

>
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?
What is errno?

>>57912796
>tfw can't drive to work without a monad

>>57912932
The set of values representable by the boolean type is composed of 0 and 1. How is that not an integer type?

>>57913092
>perfect language
>it's identical to one that already exists, but with one of the best features removed
>>
>>57923989
>using the you meme invented by /s4s/

kill yourself
>>
>>57923998
(you)
>>
>>57924032
>using the you meme invented by /s4s/

kill yourself
>>
>>57924036
(you)
>>
>>57924054
>using the you meme invented by /s4s/

kill yourself
>>
>>57924065
kys (you)rself
>>
>>57924112
>using the you meme invented by /s4s/

kill yourself
>>
>>57911490
>>If you don't use Java clean out your desk
>Shill harder
>Java

Oh my sweet summer child. Languages that use null-terminated strings are the exception these days, not the rule. It's not just Java, I actually have a hard time thinking of a language that actually sees any use these days that uses null-terminated strings as its primary string type.

You still see languages that come out that allow null pointers or references. You NEVER see languages that use null-terminated strings as anything other than a FFI or serialization shim. EVERYBODY has learned that lesson.
>>
>>57911772
>haskell
>no concurrency
wat
Thread posts: 203
Thread images: 23


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.