[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 | Advertisement | Home]

C considered harmful.

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: 350
Thread images: 44

File: Heartbleed.svg.png (55KB, 1200x1435px) Image search: [Google]
Heartbleed.svg.png
55KB, 1200x1435px
I hate C and think it should be 99% banned. Fight me /g/.
>>
>>59456085
Fight you?
You're 100% correct
We shouldn't allow software to be written in a virus prone language like C.
>>
i love c and i think it should be banned too
>>
File: 1356236919329.jpg (58KB, 523x388px) Image search: [Google]
1356236919329.jpg
58KB, 523x388px
>>59456085
>>59456105
>>59456124

You better shut up or else
>>
>>59456130
don't you fucking do it
>>
>>59456130
don't you fucking dare
>>
Rust faggots need to be banned from the internet
>>
>>59456225
OP here. Rust is garbage. Just use C++.
>>
>>59456139
>>59456161
He's not gonna do it
>>
You can ban C all you want. It doesn't respect your boundaries.
>>
File: 1471842218015.png (301KB, 480x336px) Image search: [Google]
1471842218015.png
301KB, 480x336px
>>59456259

I WARNED YOU
>>
>>59456283
>>
Not gonna lie, former C programmer here. This is fucking hilarious watching C segfault and crash. But in all seriousness we can't let these buffers get more overflows.
>>
No programming language, no matter how vulnerable of programs it is capable of producing, should ever be banned. Keep government regulations out of programming entirely!
>>
>>59456355
Who said the government had to be involved? Fucking paranoid Americans.
>>
>>59456280
underrated post
>>
>>59456415

Let me ask you something... you want to "ban" programming in C. Okay. What happens when someone decides to program in C anyways despite your ban? What punishment should be given to them? What group should enforce said punishment? What should happen if programmers, by and large, decide to ignore your ban due to an inability to enforce it?

There is no association of telling programmers what they can and can't do. You can say programming in C is now banned, but that would be meaningless, because I can still type in this:

#include <stdio.h>

int main(void)
{
char tinybuf[4];
gets(tinybuf); /* I'm so fresh you can suck my nuts */
return 0;
}


And now what? What are you going to do about it?
>>
>>59456497
>And now what? What are you going to do about it?
Calling the cops enjoy your jail time and b&
>>
File: noice.png (100KB, 241x207px) Image search: [Google]
noice.png
100KB, 241x207px
>>59456280
>>
>>59456497
Holy shit you are fucking retarded. It's as simple as saying, "No C in the repo, please." Companies can ban C easily.
>>
>>59456547
>implying anyone is going to start rewriting kernels and libraries in Rust, D, or C++.
>implying anyone has an issue writing safe C except brainlets
McFucking kill yourself.
>>
File: glasses.gif (457KB, 390x293px) Image search: [Google]
glasses.gif
457KB, 390x293px
>>59456283
DUUUUUUUUUUUUUUUUUDE
>>
>>59456577
>writing safe C
No such thing, the only way to write safely in ANY language is to type your shit in something like Coq and then export it to your target language.
t. professional C and OCaml shill
>>
Github should forbid C projects and kick out the disrespectful Linux kernel developers that just milk their infra and contribute nothing back.
>>
>>59456355
>>59456497
>retarded libertarian tripfag thinks "banned" means the Programming Gestapo kicking down your door and snatching your keyboard away
This is why nobody takes you seriously. You can only think in absolute, childish, paranoid fantasy.

Any reasonable person would interpret "banned" to be a standards body that says "Want to contract with us? Then no C allowed."
>>
File: checkmate.jpg (12KB, 280x196px) Image search: [Google]
checkmate.jpg
12KB, 280x196px
>>59456577
>only brainlets write vulns in C
why does Linus accept commits from brainlets, then?
>>
>>59456597
>what is frama-c
>what is compcert
>>
>>59456627
>something like
Also CompCert merely certifies the output is conforming to the sources (provided in bug in their frontend but at this point that's a very reasonable supposition). Don't try to fight me bro I spend my day getting shilled at INRIA
>>
>>59456085
fuck off, we have this thread every day
>>
>>59456530
1st amendment. Blow it out your ass.

>>59456547
That's not really a ban, that's just a company policy. And many companies already don't use C because their projects have no use for what C has to offer.

>>59456612
>standards body
>for programming
>that people actually give a fuck about
Excuse me while I laugh.
>>
>>59456702
Underate and/or mentally handicapped spotted.
>>
File: 1459743867776.png (29KB, 201x226px) Image search: [Google]
1459743867776.png
29KB, 201x226px
>>59456283
>>
>>59456577
>implying anyone is going to start rewriting kernels and libraries in Rust, D, or C++
They should rewrite Linux in Python.
>>
>>59456085
Ban C
delete all C books
fire C programmers
>>
>>59456491
Is there any logical reason why you would fucking say that post is underrated? Has anybody expressed any kind of dissatisfaction or criticism at all against it? Are you delusional? Are you reading replies that are nonexistant? Maybe you come from communities with voting systems, but there is literally no way that you could know what other people think of that post you just replied to here. Maybe it's psychological. Maybe it's your own post you're replying to, like a 12 year old fucktard liking his own facebook posts thinking his swelling autism is going unnoticed. Maybe your self esteem depends on you tricking yourself into thinking someone out there thinks your post is worth something. Or maybe you are just a retard, the worst kind of retard, the one who thinks he's smart, the one who thinks he's the only one to have gotten the joke, to have understood the post. Well, guess what, faggot, that post is by no definition underrated so why don't you do the world a favour and go check out what the bottom of your toilet smells like?
>>
It's simple. All C programs has to be rewritten in other safer languages. After gradually porting them to better and safer language we extarminate all C programs and books.
>>
Sorry, my mom's husband taught me not to beat up retards.
>>
>>59456547
I bet you think companies should also have COC.
Are you rust programmer?
>>
>>59458555
I bet you think programs should have security vulnerability.
Are you a C todder?
>>
>>59456603
git was made in C
>>
>>59456085
Alright, I'll bite.

Why do you think C is harmful and should be banned? It's a powerful tool, and like any tool it can be misused. Banning tools just because they can be misused is retarded.
>>
Ban everything except Intel x86 assembly. No abstractions allowed.
>>
>>59458571
Because C is the source of all 0days in recend days
>>
>>59458580
https://en.wikipedia.org/wiki/Correlation_does_not_imply_causation
>>
>>59458580
Wordpress and PHP cause far more harm daily than all of the C buffer overflows combined.
>>
>>59458580
>C is source
So, like a moron that you are you are blaming tools what about, actually making programmers accountable for their fuck ups?
>>
>>59458580
0 days are caused by bad design, which is a vulnerability in *all* programming languages.
You might as well ban typos.
>>
>>59458610
>0 days are caused by bad design
C doesn't provide 1 safety features to prevent vulnerability
>>
Nonprogrammer here, been reading "Learn C on The Mac" while on the toilet for a few years. Have to say C as a language looks pretty sharp to me.
>>
>>59458625
>Nonprogrammer
Found your problem. Go maintain a C program and you will know
>>
>>59458617
>1 safety features
Go home, Pajeet.
>>
>>59458631
Not an argument
>>
>>59458625
>while on the toilet for a few years
You certainly have problems if you couldn't shit for a few years
>>
>>59458617
Safety "features" are always result in restricting freedom.

If you want safety, go write all your programs in ADA. A couple days of writing code with your hands tied behind your back will show you what it means to pay the price of restricting freedom in the name of 'safety'.

It's like cutting up the rope you want to use to hold something, to prevent you from accidentally hanging yourself. See >>59458571
>>
>>59458643
>Safety "features" are always result in restricting freedom.
If you want occasional freedom, wrap them up with an unsafe block, no worries there
>If you want safety, go write all your programs in ADA. A couple days of writing code with your hands tied behind your back will show you what it means to pay the price of restricting freedom in the name of 'safety'.
Programming in C feels just like that. C lacks a lot of features that I shouldn't have to worry about in the current decade. I don't hate ADA.
>It's like cutting up the rope you want to use to hold something, to prevent you from accidentally hanging yourself.
Wrong analogy
>>
>>59457058
I agree with you
>>
>>59456612
What's wrong with tripfags faggot?
>>
>>59458667
>If you want occasional freedom, wrap them up with an unsafe block, no worries there

I've got a better idea; don't write shitty unsafe code in the first place. The language always does what it's supposed to. It's YOUR responsibility as a programmer to use it in such a way that you don't shoot yourself in the foot.

>Programming in C feels just like that.
C is free. If you wanted to do inline assembly, cast a void* to char* to unsigned*, you very well could. If there is a hack that allows you to save computational time and memory, then by C you should be allowed to do it. But saying you should ban C just because it *allows* you to, is ridiculous. Ban the programmer who doesn't know what hes' doing instead.

>Wrong analogy
In exactly what way? You're proposing on banning a tool because it can be misused. Shall we go on to ban all cars next, because they could be used as massive, speeding bullets? This "ban unsafe things" logic can be taken to the ridiculous extreme.
>>
>>59458705
They are retards in general
>>
>>59458667
what if I want to write code to 4bit C4004 that is not compatible with the "safety" features that modern "safe" language provide?
>>
File: stefannnich.png (678KB, 1059x557px) Image search: [Google]
stefannnich.png
678KB, 1059x557px
>>59456085

We should ban all Hammers and instead use dildos on a stick.
>>
>>59458711
>I've got a better idea; don't write shitty unsafe code in the first place.
Agreed. Safety should not be occasional
>The language always does what it's supposed to.
Not with undefined or unspecified behaviors, no.
>cast a void* to char* to unsigned*,
Doesn't look like very safe there
> But saying you should ban C just because it *allows* you to, is ridiculous.
We should ban guns without safety locks to civilians too
>>59458727
I would ban a loose hammer
>>
>>59458667
>C lacks a lot of features that I shouldn't have to worry about in the current decade.

Like what, exactly?
>>
>>59458724
ASM
>>59458751
Like strings
>>
File: 1451929800266s.jpg (5KB, 250x183px) Image search: [Google]
1451929800266s.jpg
5KB, 250x183px
EVER SINCE I LEFT THE CITY
(YOU)
>>
>>59458762
C has strings dump fuck.
>>
>>59458762
String manipulation is super fucking easy in C, what are you talking about
>>
>>59458770
string str = "Oh no"; //<- does not compile
>>
>>59458762
so, when ASM then becomes only way to write MCU code, will you start spouting how unsafe ASM is?
>>
>>59458779
Doesn't compile on java either, does that mean java doesn't have strings?
>>
>>59458778
>String manipulation is super fucking easy in C
Write a program that takes any number of strings, joins them and prints out the memory address of the joined strings in C
you got 5 minutes
>>
>>59456085
fight you? you already lost kek
>>
>>59458789
what
String s1 = new String("hello");
String s2 = "hello";
>>
File: laugh.jpg (217KB, 839x1083px) Image search: [Google]
laugh.jpg
217KB, 839x1083px
>>59456085
>/g/ is presented a quantifiable problem that can be addressed with quantifiable results through practical measures
>/g/ responds with generalized moralizing among other non-arguments and offers vague admonishments in place of a solution

sasuga /g/. They don't call this board brainlet central for no reason

Imagine if you ancrap retards were in charge of other things:

>research has shown that Pintos are exploding!
>umm, jeez maybe drive better?? Your car can't explode if you don't crash in the first place!
>>
>>59458805
char *str = "your dump fuck";
Point was that


string str = "text";
[/code]
Doesn't compile on either in Java or C.
>>
>>59458805
>I added new code

Oh, so adding code is allowed?
>>
>>59458814
excuse me?
https://www.quora.com/How-do-you-declare-a-string-in-Java
>>
>>59458748
>Agreed. Safety should not be occasional

It should not be iron-clad either. If a programmer wants to revolutionize the way things work with an unsafe optimization, they should be allowed to do so. See: https://en.wikipedia.org/wiki/Fast_inverse_square_root, which leads me to address the next thing...

>Not with undefined or unspecified behaviors, no.

The thing about C gives you enough power as a programmer to implement undefined behavior is exactly what makes it so powerful in the first place. And as Uncle Ben once said; with great power comes great responsibility.
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_14.html
http://blog.llvm.org/2011/05/what-every-c-programmer-should-know_21.html

>We should ban guns without safety locks to civilians too
And then we have armed, well-trained civilians dying because they had to turn off the safety mechanism while an armed robber was shooting at them.

>I would ban a loose hammer
That's also a bad analogy; a loose hammer doesn't do it's job. C as a programming language always does its job properly and malfunction of it is caused by YOU the programmer. There's no blaming tools allowed on mathematical and abstract trinkets here. They are not like hammers - they don't wear and tear or grow old.
>>
>>59458813
yeah youre right I love the government especially MKULTRA
they just werx yknow?
https://www.youtube.com/watch?v=lCUfGWNuD3c
>>
>>59458790
void niggers(char** strings, int stringcount)
{
int i;
int len = 0;
for (i = 0; i < stringcount; i++)
len += strlen(strings[i]);

char* joined = (char*)malloc((sizeof(char)*len)+1);
strcpy(joined, strings[0]);

for (i = 1; i < stringcount; i++)
strcat(joined, strings[i]);

printf("%p\n", (void*)&joined);
}
>>
>>59458837
>It should not be iron-clad either. If a programmer wants to revolutionize the way things work with an unsafe optimization,
Nothing prevents anyone from using unsafe blocks anon. However a C program itself is within unsafe block by default
> while an armed robber was shooting at them.
There are police just for that and armed robbery is not a daily occurence
> a loose hammer doesn't do it's job
It does if you poorly bind it together with tapes and careful enough, sounds likce C, doesn't it?

>>59458859
That's so much "easier" than
import std.stdio;

void main(string[] args){
String final_string;
foreach(arg; args){
final_string~=arg;
}
writeln(&final_string);
}
>>
how to build latest gtk3 app statically on win?
should i git and compile every dependency into .a or .lib? is it possible?
>>
>>59458859
>He took 10 minutes to join a string
Truly, authentic C experience
>>
>>59458853
>bounds-checking is a Hoover-era FBI program that sought to subvert radical leftist activity
??
>>
>>59458878
It's like 3am

>>59458870
>If everything is hidden behind libraries somebody else wrote, then that means it's better!
>>
>>59456085
func main() {
println!("Where my Rustaceans at?");
}
>>
>>59458870
>Java is easier
who cares?
>>
>>59458891
>>If everything is hidden behind libraries some retarded potato pajeet wrote, then that means it's better!
ftfy
>>
>>59458891
Are you saying you didn't use libraries in that function?
Really made me think
>>
>>59458870
>>59458891
Also I could just as easily have written

char poopynappy[1024*stringcount];
strcpy(poopynappy, strings[0]);
for(i = 0; i < stringcount; i++)
strcat(poopynappy, strings[i]);


if I didn't want to care about memory usage
>>
>>59458908
That's not even a whole program
>>
>>59458870
>Nothing prevents anyone from using unsafe blocks anon. However a C program itself is within unsafe block by default

There is nothing wrong with that. Put safe blocks around your code explicitly. C is not a tool for writing "safe" code to begin with; it is close to the metal and assumes that the people work with it care more about performance than safety. That is what it was made for. If you want safety at the expense of performance, use another language like Java or Ada.

>There are police just for that
You are either very naive or very dishonest. We both know that it (1) takes time for police to get to the crime scene and when seconds count, it simply doesn't compare to instant access to a gun, and (2) When guns are involved in domestic violence police are the ones to clean up the mess, not prevent innocent deaths (which is what unhindered access to guns are intended for in the first place).
>and armed robbery is not a daily occurence
Neither is access to guns. But arguing that they should be restricted for that simple fact is ridiculous. It's only appropriate that tools that should be used very rarely should be reserved for very rare occurrences, such as domestic robberies.

>It does if you poorly bind it together with tapes and careful enough, sounds like C, doesn't it?

Sounds like a problem with you. C would be the tapes and wood. Or are you going to propose we should ban those, too?
>>
>>59458906
Let me rephrase that:

The way you wrote it, the string is being created, then new memory is allocated, the original string is copied over, then the new addition is added it.
You are creating and destroying strings every single time you concat onto it, which is hugely wasteful.
String manipulation is trash in any language, but it's not magically difficult in C.

>>59458922
#include <stdio.h>
#include <string.h>

int main(char** argv, int argc)
{
int i;
int len = 0;
for (i = 0; i < stringcount; i++)
len += strlen(strings[i]);

char* joined = (char*)malloc((sizeof(char)*len)+1);
strcpy(joined, strings[0]);

for (i = 1; i < stringcount; i++)
strcat(joined, strings[i]);

printf("%p\n", (void*)&joined);
return 0;
}


There you go, dingus
>>
>>59458561
>calling people C todders

That's not even funny you fucking retard.

SHILL THREAD.

Shills plz leave.
>>
>>59458870
>java
>not compiled into raw assembly
fn join(strs: Vec<&str>) -> String {
let mut concat = String::new();
for str in &strs {
concat.push_str(str);
}
concat
}
>>
>>59456577
https://www.redox-os.org/
>>
>>59458935
>Two header file calls
nice
That's not what people call rephrasing anon. However, linking arrays for simple task such as that should not be a concern in the current decade. IF I cared about that theoratical performance gain I could have done the exact same thing in my code. The difference is I can actually choose not to while you can't
>>
LANGUAGE FIGHT
>>
>>59458980
>header file calls
>calls

Shows how little you know.
>>
>>59458980
>The difference is I can actually choose not to while you can't
Sure I can.
I literally just wrote the code for it, and now I have the function for it.
>>
>>59458991
I USE PYTHON AND R MOST TIMES AND SOMETIMES BASH

I KILLED A MAN WITH A SHELLCODE
>>
But why use Linux if clang is banned? Am I supposed to rewrite my toolchain in python?
>>
>>59458944
You don't have to come to this thread if you don't like it. Calling everyone who doesn't like C is not a solution of your problem
>>59458992
>C
I have no reason to bother with that language
>>59458997
You can't really add tons of other functionality that C misses just like that
>>
>>59459000
Why is your "toolchain" compiler dependent? Are you that standards averse?
>>
Why are you not shitting up /dpt/?
>>
>>59459012
That's where I'll go next.
>>
>>59459014
>next
>>
>>59459007
>You can't really add tons of other functionality that C misses just like that
That also was never my argument. My argument is that string manipulation is not difficult in C.
>>
>>59459029
And your argument failed miserably
>>
>>59458779
typedef string char *;

?
>>
>>59459035
Do you typedef chars from ints too?
>>
>>59459032
>You took more lines to do it, therefore it's worse
I can write FizzBuzz in Perl in fewer characters than either C or C++, that doesn't make it a compelling argument to use Perl in favor of them.
Besides that, what I wrote is more performant. So, what, exactly, is your counter argument?
It can't be efficiency, since we already know it's incredibly wasteful in operations and memory.
It can't be line count, since that's not a relevant indication of anything
So where's the problem?
>>
>>59459008

Because it's what I know. If you take gcc out of desktop Linux you destroy 99% of its functionality for most of its core users. Ban C for Microsoft. Leave my OS alone or make user-friendly DEs illegal so script kiddies will migrate back to Windows.
>>
>>59459032
Java does not have the performance of C. Plus, there are no pointers in Java.

Well, there are, but they're nowhere as powerful. See http://mindprod.com/jgloss/pointer.html

/thread
>>
>>59458945
Let rust mature a little bit more
>>59459053
Being able to be verbose and short when needed

>>59459060
>Java does not have the performance of C.
ASM is kinda faster and more minimal than C
I hate this "powerful" buzzword though
>>
>>59459057
The kernel is never going to not be C.

I think C is just fine. Ultimately, people should be thinking that way. Ultimately, they should be thinking in binary encoded instructions on a fucking CPU. But variety is the spice of life. C, Rust, Golang, Haskell. Play with them! Have fun! Learn something!
>>
>>59459071
>ASM is kinda faster and more minimal than C
>I hate this "powerful" buzzword though

I'll use C# as a placeholder for Java, since the two are pretty similar, and I'll use C++ as a placeholder for C, for this analogy.

Try making a game in C++ / DirectX and then try doing the same game in XNA implemented using C#. Make a scene with a single model and write some code that determines, when the user clicked the mouse, if an object was intersected and if so which point on the object was intersected. In C++ this is trivial. You have direct access to the Vertex Buffer you can simply offset into it, cast it to a pointer, and you're done. In XNA using C#, there is no good way to do this. The recommended way, which is pretty freaking awful (although admittedly very simple), is to write an fairly simple extension to the build system that augments the model with easily accessible vertex information. But here's the thing: The model already contains all the vertex information in the vertex buffer. Doing this approach at a *minimum* doubles the amount of storage required for a model's vertex information. You're storing the exact same information twice.
>>
>>59459071
>ASM is kinda faster and more minimal than C

C compiler is better than any human
>>
>>59459071
>8 lines is verbose
>>
>>59459035

char foo = 'a';
char *bar = &foo;

now what? is it a string?
>>
>>59459081
>Try making a game in C++ / DirectX
That's not C. Don't think they are the same language either.

>>59459082
So you are saying "So, like a moron that you are you are blaming tools what about, actually making programmers accountable for their fuck ups?" from >>59458602

>>59459084
It only builds up, anon
>>
>>59459060
You don't want retards and dumbass blackhat hackers (see retards) with access to pointers. FFs, why do you think memory safe languages were invented in the first place?
>>59459071
>powerful buzzword

preach.

the kiddies don't always understand the why of things. They still think the world is a good place full of good people.
>>
>>59459081
C# is Microsoft's answer to Java, for fuck's sake. you are one Corporate shill arguing against another.
>>
>>59459098
>It only builds up, anon
So does sloppy memory management.
Pick your poison.
>>
>>59459071
>ASM is kinda faster and more minimal than C
Says someone who has, clearly, never written useful programs in either language.
>>
>>59459108
You are still in this thread? Calling people shills won't stop anyone from posting
>>59459115
Again, I have the choice not to be verbose within a scope
>>59459116
In this age, C is not really useful outside drivers and microkontrollers
>>
>>59459098
the compiler doesn't change bugs programmed in, but it'll compile into a faster binary than one written in asm by a human
>>
>>59459128
>microkontrollers
micro controllers*
>>
>>59459128
>In this age, C is not really useful outside drivers and microkontrollers
Or in any arena where optimized bare-metal algorithms are going to be useful.

C is close-enough to as-good as assembler, unless you need weird-ass binary encoding tricks.
>>
>>59459098
>That's not C. Don't think they are the same language either.

I am using an analogy to show, in terms that I thought you could understand, the distinction in terms of power between C and Java. C is far more powerful, but it's easier to shoot yourself in the foot. Java is far safer, but there is a performance cost and you don't have as much freedom. If you're not going to bother reading opposing view points why are you even here?

>So you are saying "So, like a moron that you are you are blaming tools what about, actually making programmers accountable for their fuck ups?"

No one is blaming the tools here. A human could very well outdo a compiler with ASM code. Most can't and instead use tools (like C) that optimize it for them. That is why they are using C and not ASM.
>>
>>59459128
>You are still in this thread? Calling people shills won't stop anyone from posting
I don't care if you keep posting, but C# vs. Java is a bullshit argument. Microsoft vs. Oracle. Whatever. Nobody who matters cares.
>>
>>59459147
You just don't compare C++ with C, C++ is two decades ahead of C while Java and C# is pretty similar
>>59459145
>C is close-enough to as-good as assembler
For now that is
>>
>>59459162
>cont.

Also, Nobody who matters can't learn either language well enough to work a corporate job churning out boilerplate bullshit in less than a fucking month.
>>
Not even known C compilers are written in C++ anymore
>>
>>59459164

That makes no sense. C and C++ are two different languages with two different purposes.
>>
>>59459162
>C# vs. Java

It wasn't C# vs Java. It was C++ vs C#
>>
>>59459164
>For now that is
Hahahahahaha.>>59459164

hahahahahhahahahahhahahahhahahahahhahahahahahhahahahahahhahahahah

proven idiot

hahahahahahahahahahahah

luser

gtfo, go learn some real shit
>>
File: 1457576969366.jpg (47KB, 600x600px) Image search: [Google]
1457576969366.jpg
47KB, 600x600px
>>59456283
>>
>>59458884
your pinto non argument is retarded
there are no car models that have killed no one
>>
>>59459128
>I have the choice not to be verbose within a scope
Well I guess I can't argue against that, but that's also a really silly reason to say C isn't worth using.
>>
File: 1488577937023.png (81KB, 512x288px) Image search: [Google]
1488577937023.png
81KB, 512x288px
>>59459180
C++ has the purpose of replacing C, in which it succeded 80% I would say. Look how limited the usage of C these days

>>59459185
Did I just make you upset?
>>
>>59456283
That's an overkill, anon
>>59459192
Atleast someone gets the point
>>
>>59459196

>C++ has the purpose of replacing C

What. Where is that stated? Bjarne just started on C++ because he hated using C when he was used to using stuff like simula

And that graph is a bunch of benchmarks. They say nothing of language usage.
>>
>>59459214
>And that graph is a bunch of benchmarks. They say nothing of language usage.
It wasn't directed towars you. However, if you notice carefully, most of the heavy programs in desktops are C++
>>
>>59459227

I wonder if desktop usage is actually the majority of computer usage. By this is mean by processing work, not merely a headcount.
>>
>>59459240
How many software gets released for desktops and tablets these days? I think it's a massive number
>>
>>59459246
It doesn't matter. Saying that C should be banned is ridiculous.
>>
>>59459246
>tablets
I should've said handheld devices
>>
>>59459248
Why would you cling to unsafe and vulnerablity prone techonology?
>>
>>59459246

Most desktop and tablet applications are enterprise software and most of those are certainly not written in c or c++
>>
>>59459263

Because I like pointers, power, and performance.
>>
>>59459263

Vulnerability isn't bound to a language. There are vulnerabilities in every language.
>>
>>59459275
That complies with OP's suggestion
>>59459277
>pointers
Not really necessary in almost all tasks. There are also smart pointers in modern languages. My language has the "ref" keyword
>Power
Modern hardware
>Performance
Interestingly enough most of your performance drain comes from your algorithm.
>>59459289
Not having bound checks doesn't help
>>
>>59459300

Hardly, it says nothing of what programs receive the most processing power, merely which ones are immediately visible from end users. A ban on C or change of philosophy among people who use C at present would have little influence on desktops
>>
>>59459300
>>Power
>Modern hardware

Go read >>59459081 if you want to see why that thinking is flawed, and read it through this time.

Not having the power will always incentivize people to use C instead. It's like mergesort vs bubblesort. No matter how powerful you make your computers, the mathematical nature of certain problems will always favor solutions where you have enough freedom to solve it more effectively. In any case, if you scale the problem large enough, O(n logn) will always outdo O(n^2), no matter how powerful you make your computer.
>>
>>59459341
>t's like mergesort vs bubblesort. No matter how powerful you make your computers, the mathematical nature of certain problems will always favor solutions where you have enough freedom to solve it more effectively.
That's what I said, "Interestingly enough most of your performance drain comes from your algorithm."
Furthermore you are forgetting two important things
1. You can be just as fast and powerful with inline ASM when required
2. You can utilize modern hardwares with concurrent programming. The CPU is way more powerful than it was before. GPU acceleration is also a thing

My point is, with modern and safer languages, safety is a default. You can write C algorithms in almost all languages if you want that performance too, But C just lacks comfy features. Code snippet (un)releted
import std.algorithm;
uint update_points
(in int goals_team1, in int goals_team2, ref int points_team1, ref int points_team2)

in
{
assert((goals_team1 > 0) && (goals_team2 > 0));
}
out (result)
{
assert((canFind([1,2,0], result)) == true);
}
body
{
uint game_result = uint.max;

if (goals_team1 != goals_team2)
{
points_team1 += 3*goals_team1;
points_team2 += 3*goals_team2;
game_result = (goals_team1 > goals_team2) ? 1 : 2;
}
else
{
game_result = 0;
points_team1 += 1;
points_team2 += 1;
}
return game_result;
}
unittest
{
int points_team1_test1 = 14;
int points_team1_test2 = 1;
int points_team1_test3 = 99;
int points_team2_test1 = 22;
int points_team2_test2 = 19;
int points_team2_test3 = 4;
assert(update_points(4,3,points_team1_test1,points_team2_test1) == 1);
assert(update_points(1,4,points_team1_test2,points_team2_test2) == 2);
assert(update_points(2,2,points_team1_test3,points_team2_test3) == 0);
}
>>
>>59459387
>You can write C algorithms in almost all languages if you want that performance too

No, you can't get the performance of C in Java, take casting for example; it's static in the former and dynamic in the latter.

>You can utilize modern hardwares with concurrent programming.

C can do concurrent programming. http://gribblelab.org/CBootcamp/A2_Parallel_Programming_in_C.html
Don't go pretending that C isn't useful for concurrent programming, especially in the case of kernels.

C is by its nature closer to the metal, and thus less safe. It was intended this way.
>>
>>59459439
Why do you always bring Java up? I can't say much about it since I don't have much knowledge about it. I think Java has a very solid niche just like C -- android programming. Like it or not, Java is just there and no one is going to write a kernel using Java

>C can do concurrent programming. http://gribblelab.org/CBootcamp/A2_Parallel_Programming_in_C.html
So can other languages
>>
>>59459467
>Java is just there and no one is going to write a kernel using Java

My point exactly. Banning C in favor of using more safe, less performance-oriented languages *such as* Java, in places where performance and power is needed (such as kernels, graphics programming, etc) is ridiculous. C has its uses.
>>
>>59456497
gets is obsolete in C11 and has been marked obsolescent since C99.
>>
>>59459489
>in places where performance and power is needed
I suggest Rust
>>
>>59459502
>gets is obsolete in C11
It was actually removed completely.
>>
>>59459610

Pretty sure nothing gets removed. All newer versions of C are backwards compatible. Sadly.
>>
>>59456497
coding C -> thats a paddlin'
>>
>>59458521
and all performance goes to java tier shit
>>
>>59459670
>Pretty sure nothing gets removed
No, it was actually removed completely. The only reference to it in the standard is in the section where they said they removed it.
>All newer versions of C are backwards compatible. Sadly.
That's not true. C standards are _mostly_ backwards compatible, but not completely.
For example, C99 removed the "implicit int" and "undefined function" (or whatever it was called) features.
C11 removed gets.
>>
File: 1489009806137.gif (724KB, 267x150px) Image search: [Google]
1489009806137.gif
724KB, 267x150px
>>59459690
>Writing in C means you get spanked now
>>
>>59459724

Ah well nothing lost there.
>>
File: 97378268924.gif (184KB, 365x670px) Image search: [Google]
97378268924.gif
184KB, 365x670px
>>59456283
>>
File: Confused Anime Girl.gif (3MB, 515x479px) Image search: [Google]
Confused Anime Girl.gif
3MB, 515x479px
>>59456283
DELET
>>
File: IYyucIx.jpg (19KB, 400x320px) Image search: [Google]
IYyucIx.jpg
19KB, 400x320px
>raw pointers
>raw
>>
>>59458564
wrong.

the useful parts of git are written in shell and perl.
>>
4chan runs on C nginx. where is your god now
>>
Any Rust fag here?
Can you write a program that
1. Creates a vector of ints
2. Adds 1 ... n to the vector
3. searches x ∈ [1 ... n] and if found prints ("found")

C/C++ fags are welcome too. I need this for benchmarking purposes
>>
>>59460406

Sure you can. Rust is turing complete.
>>
>>59460419
I know, I just want to benchmark Rust, C, C++ and D that's all.
>>
>>59460406
You can use parallelism if you want
>>
>>59460406
>one does not simply writes in rust
rust is used mostly by C gods to trigger each other on /g/
>>
>>59460449
Can you please make the program? I don't want to be involved in any language wars here, I just want to see a benchmark
>>
The problem with C is that it is too easy to do the wrong thing. If you write your high level code in a safe language and your low level code in asm you will keep as much code as you can in the easy language, typically the safe one. C is shit because its easier to write shit code than good code. I'm not saying unsafe code shouldn't exist, but it should be contained and difficult to write in an effort to reduce places for unexpected behavior to cause low level flaws.
>>
>>59460473
You know what I am? I'm a dog shitposting on /g/. I wouldn't know what to do if I didn't have /g/ to shitpost in! I just shitpost. Js-monkey has plans. The rusticks have plans. Java fags got plans. Y'know they're schemers. Schemers trying to write their shitty fizzbuzz. I try to show the schemers how pathetic their attempts writing software are. So when I say that you and your benchmarks was nothing personal, you know I'm telling the truth. It's the schemers that put you where you are. You were a schemer, you had plans, you posted in lang war thread expecting from anon to deliver actual code, and, uh, look where that got you.
>>
>>59456085
>Herp a derp I hate C
Tell us what language you main so we have a good laugh, little baby
>>
File: xx.jpg (169KB, 964x371px) Image search: [Google]
xx.jpg
169KB, 964x371px
>>
>>59460591
R U S T
U
S
T
>>
>>59459721
Java is still in the same order of magnitude as C concerning speed. It doesn't go wonky until you go to JavaScript, python etc.
>>
>>59460617
Sure, you can be as fast as C if you use half of your computer memory for every program.
>>
>>59460616
I bet you're right
>>
>>59460616
R u s T
u s
s u
T s u Я
is sjw corporate evil shit
>>
>>59460636
Sums up the only argument against Rust
>>
>>59460643
XD
>>
File: 132819651955.jpg (138KB, 1195x788px) Image search: [Google]
132819651955.jpg
138KB, 1195x788px
Tell me of at least ONE relevant program written in Rust.

I bet you can't.
>>
File: 1478885117144.jpg (17KB, 225x225px) Image search: [Google]
1478885117144.jpg
17KB, 225x225px
I'm developing my program in C and there's nothing you can do to stop me.
Stay jelly, Rust baby
>>
>>59460685
>I'm developing my program in C
No wonder C programs are indefinitely shit
>>
>>59460708
>Triggered Rust baby
>"Y-Your C programs are shit"
Ahah, nice try Rust peasant.
Enjoy your 0 Rust programs
>>
>>59460763
>>59460685
>>>/b/
>>
>>59460784
>>>/8===3/
>>
File: CvsRust.jpg (23KB, 312x294px) Image search: [Google]
CvsRust.jpg
23KB, 312x294px
>>59460784
>>>/lgbt/
>>
>>59460795
that's a strange benis
>>
File: 1487463346405.png (97KB, 1934x1069px) Image search: [Google]
1487463346405.png
97KB, 1934x1069px
>>59460831
kek
>>
>>59460832
8===э
sorry
>>
>>59460849
C toddlers BTFO
>>
File: 1488248151444.jpg (233KB, 503x662px) Image search: [Google]
1488248151444.jpg
233KB, 503x662px
>>59460849
>undefined behavior in Hello world
>>
File: 1488869296301.png (228KB, 3316x1896px) Image search: [Google]
1488869296301.png
228KB, 3316x1896px
>>59460849
>mfw people search for C to find out why there are 61 undefined behaviors in their program
>>
>>59460849
Wow. Is that the true power of Rust users?
I'm sooo impressed by your two lines hello word.
Call me back when you write more sophisticated softwares.
>>
File: 1470930284936.jpg (447KB, 800x800px) Image search: [Google]
1470930284936.jpg
447KB, 800x800px
>>59460849
>3 lines
>undefined behavior already
>>
File: 1486586820925.jpg (22KB, 500x396px) Image search: [Google]
1486586820925.jpg
22KB, 500x396px
>>59460895
>Call me back when you write more sophisticated softwares.
You mean more sophisticated undefined behaviors
>>
so how do i build all my LGPL dependencies static?
>>
>>59460921
ayy
>>
>same number of IP before the usual shitpost than after
Makes you think.
>>
File: 1487822049152.png (231KB, 342x342px) Image search: [Google]
1487822049152.png
231KB, 342x342px
>>59460849
EVERY
FUCKING
TIME
>>
>>59460849
c is just retarded
>>
>>59460849
I fail to see how this is a bad thing for C.
It behaves like in the following formula:
(1+1)*(2+2)*(3+3)
by computing what's inside the parenthesis first
(2)*(4)*(6)
Then compute exterior operators *
It's gonna take more than that to criticize the way C order operations.
>>
File: 1402691880003.jpg (296KB, 600x600px) Image search: [Google]
1402691880003.jpg
296KB, 600x600px
>>59460849
  4004f6:    55                       push   %rbp
4004f7: 48 89 e5 mov %rsp,%rbp
4004fa: 48 83 ec 10 sub $0x10,%rsp
4004fe: c7 45 fc 03 00 00 00 movl $0x3,-0x4(%rbp)
400505: 83 6d fc 01 subl $0x1,-0x4(%rbp)
400509: 83 6d fc 01 subl $0x1,-0x4(%rbp)
40050d: 8b 4d fc mov -0x4(%rbp),%ecx
400510: 8b 55 fc mov -0x4(%rbp),%edx
400513: 8b 45 fc mov -0x4(%rbp),%eax
400516: 89 c6 mov %eax,%esi
400518: bf b4 05 40 00 mov $0x4005b4,%edi
40051d: b8 00 00 00 00 mov $0x0,%eax
400522: e8 c9 fe ff ff callq 4003f0 <printf@plt>
400527: b8 00 00 00 00 mov $0x0,%eax
40052c: c9 leaveq
40052d: c3 retq
40052e: 66 90 xchg %ax,%ax
>>
File: 1486275222031.png (139KB, 228x260px) Image search: [Google]
1486275222031.png
139KB, 228x260px
>>59460978
>I fail to see how this is a bad thing for C.
1 1 1 GO!!!
>>
>>59460978
>falling for the bait
Also C doesn't order arguments.
>>
File: 1480333122975.jpg (103KB, 964x964px) Image search: [Google]
1480333122975.jpg
103KB, 964x964px
>>59460849
Jesus christ
>>
File: 1485173668037.jpg (106KB, 593x578px) Image search: [Google]
1485173668037.jpg
106KB, 593x578px
>>59460992
>Also C doesn't order arguments.
>2018
>>
File: 1370693556477.jpg (40KB, 261x307px) Image search: [Google]
1370693556477.jpg
40KB, 261x307px
>>59460991
>>59460989
>>59460945
>>59460908
>>59461005
Rustled rust fag resorts to samefagging and self responding.
How pathetic can one anon be?
>>
File: 1458382562740.jpg (78KB, 340x314px) Image search: [Google]
1458382562740.jpg
78KB, 340x314px
>>59461040
1 1 1 GO!!!
>>
>>59461040
>manlet C toddler in denial
>>
File: 1453648900536.jpg (115KB, 699x520px) Image search: [Google]
1453648900536.jpg
115KB, 699x520px
>>59461052
>>
>>59460991
>Write program with expected ruskt
>1 1 1 GO!!!
That is defined behaviour of printf
>>
File: 1458841365684.gif (897KB, 800x430px) Image search: [Google]
1458841365684.gif
897KB, 800x430px
>>59461065
>That is defined behaviour of printf
Undefined behavior is a behavior of C
>>
are Rust users actually reason why heartbleeding happens in C? By the looks of this thread, it sure looks like it.
>>
File: 01.png (5KB, 490x322px) Image search: [Google]
01.png
5KB, 490x322px
>>59460849

works 4 me :^)
>>
File: 1478128368324.png (143KB, 332x394px) Image search: [Google]
1478128368324.png
143KB, 332x394px
>>59461096
>Outputs varying on compilers
>>
>>59461096
>clang
how awful
>>
>>59461107
>>59461096
Oh boy, never knew it's that bad
>>
>>59461129
do you guys know, what a compiler is, right?
>>
File: 12506712512.jpg (41KB, 960x960px) Image search: [Google]
12506712512.jpg
41KB, 960x960px
>>59461143
Yeah, things that produce inconsistent C programs
>>
File: 141196065428 (1).jpg (58KB, 477x397px) Image search: [Google]
141196065428 (1).jpg
58KB, 477x397px
>>59461148
DELET
>>
>>59461096
>>59461107
>>59461148
C this is another reason why C programs are so unreliable
>>
>>59460406
Bump
>>
This Rust fag is so obnoxious.
Definitely casts a bad light on the whole community.
>>
>>59461193
Told you to go back to /b/. What happened? Met your match?
>>
>>59456085
It should be 100% banned. There's no use case for C in 2017. Rust does all the low-end better and without any chance for heartbleed and co, while even python is viable for anything more complicated than that.
>>
>>59461236
/thread
>>
>>59456334
lewd
>>
>>59459246
Desktop and tablets are a tiny minority of all computing devices.
>>
>>59461236
Ban C and the only existing rust implementation stops working.
>>
c is awful java and rust are best!!!1111
>>
>>59460406
Not sure what you're asking especially with regard to the last point, so assuming you want to go over 1..n and for each integer go over the entire vector with shortcutting, moreover printing "found" whenever the element in the vector matches the int, here's the literal solution:

let v = vec![];
let n = 2345;

for i in 1..n {
v.push(i);
}

for x in 1..n {
for y in v.iter() {
if x == y {
println!("found");
break;
}
}
}


More idiomatic:
let n = 2345;
let v: Vec<i64> = (1..n).collect();

for i in 1..n {
if v.contains(&i) {
println!("found");
}
}
>>
>>59461335
It's self-hosting so not even close.
>>
>>59461400
It uses llvm....
>>
>>59461452
llvm is c++ although i guess you could argue that c++ would also be banned if c is banned.
>>
>>59461385
With dumb parallelism:

let n = 5;
let v: Arc<Vec<i64>> = Arc::new((1..n).collect());
let mut handles = vec![];

for i in 1..n {
let v_ref = v.clone();
handles.push(thread::spawn(move ||
{
if v_ref.contains(&i) {
println!("found");
}
}));
}

for h in handles.into_iter() {
h.join();
}


Smarter:
let n_cpus = 4;
let n = 14;
let n_per_cpu = (n + n_cpus) / n_cpus;

let v: Arc<Vec<i64>> = Arc::new((1..n).collect());
let mut handles = vec![];

for i in 0..n_cpus {
let v_ref = v.clone();
handles.push(thread::spawn(move ||
{
for j in (i * n_per_cpu)..((i + 1) * n_per_cpu) {
if j >= n { break; }
if v_ref.contains(&j) {
println!("found");
}
}
}));
}

for h in handles.into_iter() {
h.join();
}
>>
>>59461452
By this logic, this post wouldn't exist if ink didn't exist.
>>
>>59460895
>rust
It's D you illiterate pajeet. Do you literally only know one programming language?
>>
Banning C because of "saftey" is just as retarded as banning rust because it's "impossible" to learn
>>
>>59461878
It's literally easier to learn than C though, meanwhile C is even less safe than the most pessimists make it out to be.
>>
>>59461878
Don't bother arguing with rust tards.
>>
>>59461997
Rustoddlers*
>>
>>59461984
>t. rustoddler
>>
>>59462758
>>59462087
>>59461997
Your tears are my sustenance. Knowing that you are now deprecated and devoid of value makes me hard.
>>
>>59462773
psychological project at its finest.
rust has no future.
>>
>>59456497
>arguing with a retard

You /g/ people are so innocent
>>
>>59456085
>I'm a JS faggot and I hate C because I can't go further than writing a Hello World.
>>
>>59456085
no thx
>>
>>59460406
So, how's your benchmark going?
>>
>>59463840
>I'm a ctard and I love C because I never program anything beyond fizzbuzz (and there are still 3 exploits in my best fizzbuzz code)
>>
>>59463892
Sorry to be rude, but I'll have to correct you on that one. I only have 2 exploits left since I've patched one yesterday.
>>
>>59463882
I'm not authorized to reveal that information, sorry.
>>
>>59464010
It's OK, I understand. I'm not authorized to reveal how our tracking of your IP is going, either.
>>
>>59456105
>>59456085
*dipshit programmers*
>>
F O R T R A N
>>
>>59456085
In the world of real engineering, a chartered engineer must sign off on the designs before production can begin. If the bridge collapses, the engineer is personally liable. It is therefore in his interests to
>ensure that only competent people have contributed to the design
>thoroughly inspect the design using a myriad of verification and simulation methods
>make damn fucking sure it isn't going to collapse before he puts his signature to it, because if it does, he's going to be deeply, personally in the shit.

What if there were a similar system in place for software "engineering"? A certified engineer would need to review all the code and either verify its correctness or, if it's a library, check that it's a signed certified release. He would need to use a certified compiler too, on a certified platform. In the case of FOSS projects or other libraries built by unqualified persons, companies could make money by reviewing them, fixing bugs, and selling certified re-releases.

When something fucks up, the engineer who signed off on deepest layer of the stack at the point of failure would be responsible. So for Heartbleed, whoever signed off on OpenSSL would be responsible. If nobody signed off on the release that was used, the engineer who signed off on the whole project without certifying OpenSSL would be responsible. It would be illegal in almost all jurisdictions to offer a software-backed service (i.e. a website) which handles personal information to be made available without certification.

Uncertified code could still be built and released but OSes would display very strong warnings that the software is uncertified and the user is liable for whatever happens.

The practice of shitty software would end overnight. C would not be outlawed but very few engineers would be willing to use it considering the consequences.
>>
Why? You're a nobody and C will be used no matter how much you cry
>>
>>59465085
That shit is already being done in very specific fields and still only programs that AREN'T written in C don't have memory bugs. But hey, keep sucking the Cock.
>>
>>59465085 (Me)
There could be multiple tiers of certification:
* Code which doesn't handle personal information and is not compiled but instead interpreted by a certified host (such as a web frontend running in a certified browser, or a managed code desktop app with no unsafe sections) would not need to be certified. This ensures that entry-level code monkey work is still available and websites can still be rapidly tweaked and updated.
* Code which doesn't handle personal information but which executes native code (a desktop video game, a desktop app written in a compiled language or a managed language with usage of unsafe features) would require a basic level of certification. The liability under this cert would be limited (but still considerable) and it would be reasonably accessible (perhaps a bachelor's plus an additional safety course). The developer wouldn't need to worry about PII but they would still need to make sure their software can't damage hardware and would want to use certified libraries to interpret anything they read from the web; i.e. use a certified libjpeg to decode downloaded JPEGs.
* Network servers which do not handle PII (such as an anonymous forum with no private messaging features etc) would require only the same basic cert.
* Code which handles PII (a web backend which stores any kind of private details, payment processing) would require the full chartered engineer qualification I described above, with unlimited liability and a massive barrier to entry. Only the most dedicated individuals will pursue this.

I've made a few errors/omissions above and it would be more complex in reality but an approach like this would be so much better than what we have now.
>>
>>59465215
>only the most dedicated would be allowed to work on the most boring, thankless garbage
really makes you think.
>system where you need to be able to deploy security fix as soon as possible
>must wait months for the security fixes to be audited
lol
>>
>>59465085
>What if there were a similar system in place for software "engineering"?
What would happen is that nobody would ever dare do sign off on anything, because nobody knows how to do that level of verification, review, and simulation on software.

>In the case of FOSS projects or other libraries built by unqualified persons
Most FOSS projects would be built to much higher standards than corporate software, but then not signed off on because that costs money, thus helping no one.

>When something fucks up, the engineer who signed off on deepest layer of the stack at the point of failure would be responsible.
When something fucks up, you would find that nobody signed off on it because nobody would ever dare to do so, and the company that deployed the software anyway would be responsible. Exactly as they are now.

>It would be illegal in almost all jurisdictions to offer a software-backed service (i.e. a website) which handles personal information to be made available without certification.
And software services would disappear overnight. Because you are not going to sign off on anything larger than fizzbuzz and neither am I, decades of training and experience be damned.


>Uncertified code could still be built and released but OSes would display very strong warnings that the software is uncertified and the user is liable for whatever happens.
And absolutely ALL software would be uncertified, and people would either disable or ignore the dire warnings within two days.

>In the world of real engineering, a chartered engineer must sign off on the designs before production can begin.
If one misinstalled bathroom door handle could bring down a building, nobody would ever sign off on building designs either.
>>
My language can beat up your language!
>>
>>59465255
>really makes you think
If this plan was in place, all high responsibility positions would actually be well paid. There would be less shovelware running the web and more high-quality professional solutions.
>security fixes
This is just one of the details which would need to be figured out. It would definitely be important not to penalise security updates. The first idea that comes to mind would be grace periods- a company could run uncertified builds to provide a web service without being liable for regressions provided all of the following were true:
* The security patches represent the only differences between the running build and the most recent certified build
* The fixes were made by a suitably qualified person
* A full review of the fixes is made as soon as reasonably possible
* A certified fixed build is deployed promptly after the full review
* The total time running uncertified was less than some fixed span
>>
>>59456283
thats edgy
>>
>>59465413
All high responsibility positions would be paid several million dollars per month and still nobody would take them. You're just as retarded as any other cucktard. Really no surprise there.
>>
>>59461752
Why is Rust so ugly?
>>
>>59465484
It's pretty much as pretty is infix languages come bro.
>>
>>59465501
All infix languages are ugly.
>>
>>59465514
I agree.
>>
>>59465501
Most languages are infix and many are prettier than Rust. E.g. Python.
>>
>>59465523
Write the equivalent in python. No amount of confetti and rice will help you make it prettier than the rust version.
>>
What's the alternative to C? Not C++ just C.
>>
>>59465392
>>59465473
You make good counterpoints. I am willing to reconsider the personal liability aspect. What if we kept the education/engineering title requirements the same, and instead of personal liability we only required that evidence be presented after an incident showing that industry best practices were followed and that reasonable care and attention were paid to the security of the design? With significant fines levied at a company which can't do this/did not take reasonable care and attention, as decided by some kind of regulatory panel.
>>
>>59465541
D or Rust.
>>
>>59465560
Isn't D garbage collected?
>>
>>59465582
Optionally, yes.
>>
>rust has no epoll abstraction
>LOL just make a new thread for each file handle
>>
>>59465541
Rust.
>>59465582
Yes. They're trying to fix this but work has been very slow so far.
>>
>>59456497
>What punishment should be given to them?
prison time.

all computers with C code running in them will be destroyed as well.
>>
>>59465546
The correct solution is to stop calling it software engineering because it cannot live within an engineering framework, period. There should be a better liability model based on damage incurred by software faults, but that should fall on the company and not the individuals, because they should be doing formal proving when applicable. Thus it becomes a simple risk model without suffering any of the caveats from trying to fit the square peg in the round hole.
>>
>>59465629
Coming Soon (tm). If it bothers you that much, bind to C. It's very easy to do in rust. Rust is extremely young. At the same stage in its life, C was literally unusable, by comparison.
>>
>>59458596
this phrase really pisses me off, the word is 'cause.' Do you think you're clever for rhyming? When does anyone use the word 'causation' outside of this phrase?
>>
>>59458859
enjoy your memory leaks
>>
>>59465715
t. sub-0 IQ nigger
>>
>>59461165
>writes unvalid C which is deemed undefined behavior
>knows undefined behavior can yield whatever behavior
>is surprised of implementation-defined results on undefined behavior
>blames programmer's idiocy on the programming language

The only thing I advocate about C is that idiots should be prevented from using it. That would make your beloved Rust a language for programmer babies who can't program without a safety net. The irony is, that would not prevent them from writing either inefficient or non-compliant programs.
>>
File: scr.png (121KB, 618x983px) Image search: [Google]
scr.png
121KB, 618x983px
>>59460849
Is literally everyone in this thread batshit retarded?
This is a stupid program written by an idiot.

The behaviour of this program is undefined, just like anyone who has ever used C knows. You can't have

int i = 1;
i = i++;


because it's motherfucking retarded and makes no sense.

It's good to see morons being repelled to shittier languages. Linus is right.
>>
>>59465675
>At the same stage in its life, C was literally unusable, by comparison.
Stop spouting false statements. Rust is 7 year old. C development began in 1969. Unix was ported to C in 1972. In 1975, Unix already was at its 6th edition, it's the basis for the famous Lions' Commentary that exposed the kernel design and its system calls, which are for the most part still present in POSIX. Both C and Unix were already a big thing back in the 70s and taught in universities. Can't really say the same for Rust now, but it shouldn't be Rust main objective after all, since it was supposed to be a replacement for XUL in Firefox, and it's still not the case today, so that doesn't add much credibility to Rust in both academy and industry.
>>
>>59466103
You could google instead of proving you're clinically retarded, you know.
>>
QUICK SML OR OCAML?!
>>
>>59465546
>we only required that evidence be presented after an incident showing that industry best practices were followed
That doesn't work.

If you are only required to show convincingly that you have done your best, rather than being responsible for the actual outcome, people will very quickly learn to do whatever SIGNALS that they are doing their best, rather than what will actually help. Indeed, that is exactly what "industry best practices" already entail -- doing whatever seems impressive on paper, hopefully without costing any money, without giving a single fuck about actual security. AKA, security theater. Surely you recognize this from some daft corporate IT security policies. Engineers might want to take measures that actually work, but corporate policy has no such incentive, and will very effectively refuse to supply any budget for it.

>as decided by some kind of regulatory panel.
What you will get is a checklist of nice-sounding security features (change passwords monthly! have at least two Greek and three Kanji characters in your password!) that are easy to demonstrate and are optimized for easily convincing the regulatory panel that you have done your duty. You'll get security by committee. If you think design by committee was horrible, imagine applying it to security measures.
>>
>>59466120
>replacement for XUL in Firefox
>a language was supposed to be a replacement for an API
>>
>>59465667
This is getting into pointless semantics debate, but I both agree and disagree.

I agree that most of the techniques and ways of working in most fields of what we might call real engineering do not really apply to software engineering, and trying to interpret it to the same standards of reliability as real engineering is pointless.

However, I think the word "engineering" still applies. As I see it, engineering is not a body of techniques; it's a mentality of optimizing for the things you care about, reliability big among them, and throwing whatever scientific and analytical arsenal at it that you can manage. Our toolkit in software engineering lags rather behind that of real engineering, and few of the analytical tools transfer. But the aims, intents, and basic approaches do transfer. I think that in software engineering, those who deserve the title really do try to throw whatever analytical firepower they can get their hands on at the problem of making good, reliable, cheap, secure, etc etc software. I feel that's what the word "engineering" means, in the end; the shared body of techniques common between almost all other forms of engineering is a side effect, not a fundamental part. By that measure, I feel "software engineering" is a real thing, even if it isn't nearly as well-developed yet as the material engineering disciplines.
>>
>>59461385
>>59461752
Lol, thanks for doing my homework.

Later, nerds.
>>
>>59466197
>tfw cucked by /g/ayboi probably not even qt trap
>>
>>59466136
SML because MLKit
>>
>>59460849
AHAHAHAHAHAHAHAHAHAHAHA C IS SHITE
>>
And what about a JS to Rust transpiler? It could bring flexibility, performance and safety. As a web developer, I crave for such a tool.
>>
>>59466604
You should compile js to rust and then compile back to js. SAFETY OF RUST AND ALL THE GOOD THINGS OF JS!
>>
>>59461385
That keeps printing found
>>
>>59460849
I get an error in C.

lvalue required as decrement operand
>>
>>59466660
NVM!!!!!!!
>>
>>59460831
>C
>0.78 seconds

>Rust
>0.55 seconds

C BTFO
>>
>>59456085
I hate OP and think he should be 99% banned. Fight me, faggot.
>>
>>59466687
I was benchmarking it as well, Rust appears to be faster than C

What happened? hahahaha
>>
>>59466650
It will print it exactly 2344 times. However there are 2 mistakes in the top one: should be let mut v = vec![]; and should be x == *y.
>>
>>59466740
What are you talking about?
1 I want to create a vector 1 ... n
2 for i in vector, if i = 4000, print found
>>
L0rd_S3xXh4xoRz my son, it is time for you to start developing a new program that will be critical to your security and the security of others.
Will you chose beautiful modern language with safety guarantees whose developers built to correct the mistakes of the past
Or will you chose old C and all its quirks that require 30 years of experience in the language to avoid
>>
>>59466756
You used `n` twice to refer to 2 different concepts. This is completely on you.
>>
fn main() {
println!("Hello Rust!");
}


$ rustc main.rs
$ du -h main
1,9M main


Pls explain?
>>
>>59466936
Rust is statically linked by default. Use prefer-dynamic.
>>
Honest benchmarks:
Fastest: Rust
real 0.15
user 0.03
sys 0.13
fn main(){
let mut v = vec![];

for i in 1..5_000_000 {
v.push(i);
}

for x in v {
if x == 4_000_000 {
println!("FOUND");
}
}
}

Medium: C++
real 0.17
user 0.02
sys 0.14
#include <stdio.h>
#include <vector>

bool search(int x, const std::vector<int> &ints)
{
for (auto &i : ints)
{
if (i == x)
{
return true;
}
}

return false;
}

int main()
{
std::vector<int> ints;
const int n = 5000000;

for (int i = 1; i <= n; i++)
{
ints.push_back(i);
}

if (search(4000000, ints))
{
puts("found");
}
}

Slowest: D
real 0.27
user 0.26
sys 0.00
import std.stdio;
import std.parallelism;

void main()
{
int[] arr;
for(int i = 0; i < 5_000_000; i++)
{
arr ~= i;
}

foreach(element; arr)
{
if (element == 4_000_000)
{
writeln("FOUND");
}
}
}


Rust leads, C++ follows and D lags behind
However Considering how ugly C++ is, I'd say Rust and D are more feasible.
>>
>>59467017
Thanks, that's much better.
>>
>>59467020
The C++ solution literally has a separate "search" function that could be inlined to be in style with the others. It would look pretty much just the same in that case. I'm pretty sure the rust one is not correct because I think you need to do v.iter(), or v.into_iter() and *x, not certain though. I wonder if the more idiomatic rust code would be more or less performant.
>>
>>59467020
OH WAIT, something wrong with C++ algorithm I'll change it now
>>
>>59467020
That's a very bad benchmark.
>>
>>59467079
>fucking up so simple code
Holy shis rust fags.
>>
>>59467110
I'm not the one who wrote this, idiot, it's from /dpt/. And I think the C++ update is going to make it even slower
>>
>>59467073
>>59467020
Rust still is faster, and the example is not even idiomatic
>>
>>59467126
post the compiler flag you used nigger or it's irrelevant even though your code is biased which already makes it irrelevant.
>>
>>59467172
g++: g++ -O3 main.cpp
Rust: cargo build --release
D: ldc2 -O3 -noasm -release main.d
>>
>>59467162
It could be either faster or slower if idiomatic, e.g. if the idiomatic way actually features more overhead or can't be optimized as well.

That said, there are at least 3 major flaws with this benchmark:
- Termination is too fast so OS overhead actually is a thing at this level
- Experience is repeated only once. Try 20+ times instead with mean and stdev.
- Compilation flags are not listed.
>>
Always loved rust
>>
>>59467217
Don't take it seriously, I was benchmarking just for myself and see the difference. There are tons of better benchmarking algorithm
>>
>>59467261
Why is C++ so ugly?
>>
>>59467326
In terms of beauty: D > Rust > C++.
>>
>>59467397
But can D do this?
fn main() {
let mut v: Vec<u64> = (1..5_000_000).collect();
if x.contains(&4_000_000) { println!("FOUND"); };
}
>>
>>59467261
Just noticed that the C++ version is actually more optimized than the other versions (the other versions do not terminate when 4m is found, they go over the rest of the array)
>>
>>59467313
At least make more than one run and provide simple stats, like avg, std, min and max. Otherwise it's pointless.

Moreover, I get very different results with your inital test case on my own setup.
>>
>>59467624
Benchmarks vary on hardware, comparison ration normally doesn't
>>
>>59467660
ratio*
>>
>>59467476
>if x.contains(&4_000_000)
why do you need &?
>>
>>59467851
The contains expects a reference and rust doesn't implicitly convert a value to a reference, unlike c++.
>>
>>59467476
You could even go lazier:
fn main() {
if (1..5_000_000).any(|n| n == 4_000_000) {
println!("Found!");
}
}
>>
>>59467667
>assuming I was talking about runtimes
>>
>>59467313

With the first test case from >>59467020, 100 runs each.

C++:
     real    user    system
avg 0.159 0.150 0.002
std 0.035 0.032 0.004
min 0.110 0.100 0.000
max 0.000 0.190 0.010


Rust:
     real    user    system
avg 0.424 0.417 0.000
std 0.034 0.034 0.000
min 0.380 0.370 0.000
max 0.000 0.510 0.000


With this script:
http://pastebin.com/CG8tNLNu

Not trying to be a dick, I'm just surprised with your results.
>>
File: 1488243967606.jpg (405KB, 900x1200px) Image search: [Google]
1488243967606.jpg
405KB, 900x1200px
>>59468315
Did you let cargo optomize the code? see >>59459196
>>
>>59468315
There's a typo, s/max/max1/g on line 24.
>>
>>59468457
Actually no, i used rustc. Never used rust before that, I was just curious. I'll try that.
>>
>>59468457
>>59468315

Alright, here's Rust with optimization;
     real    user    system
avg 0.034 0.024 0.000
std 0.005 0.005 0.000
min 0.030 0.020 0.000
max 0.040 0.030 0.000
>>
>>59468601
See? Rust is faster
Thread posts: 350
Thread images: 44


[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]

If you need a post removed click on it's [Report] button and follow the instruction.
If you like this website please support us by donating with Bitcoin at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties. Posts and uploaded images are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that website. If you need information about a Poster - contact 4chan. This project is not affiliated in any way with 4chan.