/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

the-orbit.net/lousycanuck/2011/09/15/what-is-an-ad-hominem-what-isnt/
twitter.com/SFWRedditGifs

C is a disservice to intelligent programmers. It has almost 0 features that a modern and intelligent programmer uses to be productive. Since C is such a timesink, it's popularity is falling more than any other languages in the market.
C is dying and it should die ASAP. C programmers are actually retards in general. C is a small language to grasp, exactly the kind of shit that makes things retard friendly.
C has no advanced features like C++ does.

But as a newfag you are kinda in the right direction. C is for newbies. Think of it this way:
During ancient times, counting to 10 was a big deal and a person who could count to 10 was considered to be "wise".

Fast forward a few century counting to 10 is so trivial we teach this to toddlers. Now toddlers appreciate the vast "knowledge" of counting to 10 while matured brains are busy with modern technologies.

C is from stone age and the people who still preach it is like overgrown toddlers that can't learn advanced things.
C doesn't have delegates
C doesn't have resizable arrays
C doesn't have strings
C doesn't have string concatenation
C doesn't have namespaces
C doesn't have exception handling
C doesn't have closures in the standard
C doesn't have unit tests
C doesn't have Function overloading
C doesn't have memory safety of any kind
C doesn't prevent memory exploits and has no bounds and runtime checks
C doesn't have dynamic method loading/creatin
C doesn't even have generics and templates
C doesn't have meta programming
C doesn't have mixins
C doesn't have higher order functions
C doesn't have contract programming
C doesn't have inner classes
C doesn't have function literals
C doesn't have array slicing
C has a very limited support for implicit parallelism
C doesn't even have string switches

C is a cancer that plagues the modern software industry. If you want guaranteed memory exploits and security vulnerabilities in your program with timesink development period then use Assembly, not C.

>trying to argue with C and C++ niggers about types
>they think polymorphism means inheritance and nothing else

What is the final solution to the OOP question?

Thank you for posting an anime pic.

>muh zygohistomorphic prepromorphisms
>muh garbage collected 1 gb per second
Take it to the functional programming thread general, will ya?

>C++
>1 gb of template error messages per second

C is a portable assembly. Use it as such.

VLC wanted to adopt haskell for some security concerns last year, after seeing the performance they quickly fucked off. In a Google talk they were saying they were going to adopt some Rust into their codebase after Rust v1 came out

Just report and hide.

Truth hurts, doesn't it?

don't reply anymore please

>Incorrect
lol no

Butthurt C tards thinking it's their shitlang safe place

Dear anti-C fags: I can write a competent computer game in C and none of you fags will be able to say it's not competent

Dear anti-C++ fags: I can write a competent computer game in C++ and none of you fags will be able to say it's not competent

What is a "competent computer game" ?

Btw, I love both C and C++

A computer game that's competent at being a computer game

This thread is doomed from the start.

Good job.

Using C is like multiplying 6 digit numbers manually and feeling smug about it.

What are you trying to imply with that tautology?

>Rebrand Atom
>Rebrand Xamarin

wtf I love open source

Well put

Couldn't agree more

>mum, I posted it again!

Using C++ is like punching your own dick and feeling smug about it.

Does C have function overloading?

>mfw edgelords shit on the two languages that serve respectively as the father of all modern procedural programming and the father of all modern object oriented programming

C tards rekt

MUUUH POINTER AUTISM

>the father of all modern object oriented programming
I wish I could go back in time and assassinate bjarne

Partially, with C11 _Generics.

>father of all modern object oriented programming
That's not a good thing.

Weird way of saying "no"

Does C have exception handling? y/N

why would you do that when object oriented programming, particularly using mixins, is the only sane way to write a computer game

except it isn't

>father of procedural programming
What is ALGOL 60

Hell, even Fortran outdates C.

>father of all object oriented programming
What is Simula-67 and Smalltalk

why would you say that when object oriented programming, particularly using mixins, is the only sane way to write a computer game

>Weird way of saying "no"
Simply ebin xDDDDD

>Does C have exception handling? y/N
Yes, with setjmp/longjmp (and more so with signals to catch faults as well)

My rule of thumb:

Will I be using strings?

If yes, don't use C.
If no, it's ok to use C.

I would write a music program in C for instance, since music is just numbers and is time-sensitive.

OOP is a fucking terrible way to write games, or any software.
Good job fucking up your cache.

try to write a game procedurally and have it be easy to add content to (hint u can't)

>with setjmp/longjmp (and more so with signals to catch faults as well)
Is there any standard try..catch..finally syntax or is it just some poor hackjob?

>OOP is a fucking terrible way to write games
it's basically the only way to write games, procedural game development is pure agony

>hurr durr muh OOP is bad for muh cache
Looking up a vtable entry (even if you actually do so, not all functions are virtual), does not necessarily flush the cache. It's also instruction cache bound, so it doesn't affect the data cache.

/dpt/ have already compromised C and Haskell by putting its filthy hands on it. You'd better stick to Python, schoolkids.

>My rule of thumb:
Will I be writing a kernel
>yes
Might use C or assembly
>no
Stay the fuck away from C

If I want to write library to be used in higher level languages, what options I have other than C and sepples with extern "C"?

I've actually been thinking about writing an audio analysis program for a while now, and I expect it to be extremely computationally intensive.
I wouldn't imagine not using C for it.

>it's compromised
>teleports behind you
>"this is fro compromising my language, kid"
>reveals katana
>kiils a school kid

strings are just numbers tho

>It's also instruction cache bound, so it doesn't affect the data cache.
Are you fucking retarded?
Why on earth wouldn't that shit be data cache bound? Go look at Mike Acton's data-oriented design talk, you idiot.

>tfw C was adopted as the industry standard and not Ada

i've been reading about that neuro-evolution of augmenting topologies and though I'd do something with that, but i dont know what because i dont want to do le ebin nintendo emulator ai

Computer are just electrons tho

...

>Is there any standard try..catch..finally syntax
This is not necessary for implementing exceptions. C++ and Java does not have an exception monopoly.

But to answer your question, you can implement a try - catch-like structure using setjmp and longjmp, yes. But you're not limited to it.

Also remember that setjmp in C isn't like C++ exceptions, because C doesn't have RAII (at least not without compiler instructions). setjmp merely rolls back registers and state to a execution point, but you need to take additional considerations.

/dpt/ just don't understand what they're talking about, kiddo. C and Haskell are just fancy words for /dpt/ and tools for actual pros.

OOP is necessary for writing games, you cannot write procedural games.

Games basically cannot be written procedurally.

You need OOP. If you, are writing a game

>arrays are hard

In the standard? No.
As a single file library? Yes.

Arrays\0 are\0 not\0 hard\0 but\0 check\0 out\0 my\0 C\0 sckillz\0

>hitler dubs
>confirmed for fascist opinion

You're missing the point, your assupmtions are wrong. Windows, Linux and most production software does perfectly fine without "function overloading".


Some hints:
-YAGNI and KISS are still valid design principles.
-Abstractions always come at a cost.
-Linus made clear why C++ is not acceptable for Linux.
-There is no silver bullet, each language has certain advantages and disadvantages.

i saw a youtube film and now i think i understand caches - the post.

Function code does not reside in the data cache. A simple address lookup is a mere 4-8 byte index into a table, you fucking tool. But I bet you think data structures such as hash tables are cache-unfriendly too, don't you?

that's not C

>Linux
Isn't that literally the worst kernel in existence?

tell me one (1) disadvantage with using Ada

OOP IS IMPORTANT BECAUSE GAMES CANNOT BE WRITTEN PROCEDURALLY WITHOUT OOP, WHICH IS IMPORTANT FOR WRITING GAMES.

Rust gives abstractions with practically no costs

It tickles my autism that it's named after a cockslut who grabbed all the fame and attention from Charles Babbage.

No one uses it.

Pascal was better.

because C doesn't have strings

>-Linus made clear why C++ is not acceptable for Linux.
1) Linus' point is based on an outdated understanding of pre 1998 C++ and his view on programmers and developer culture, more than the actual language

2) Linus is a twat

3) Linus has programmed in C++ himself for other projects

YOU NEED OBJECT ORIENTED PROGRAMMING WITH MIXINS TO WRITE GAMES.

THEY ARE NECESSARY, IF YOU WANT TO WRITE GAMES.

Ok

please dont trash-talk my wife

sure they do, mostly maintenance of old stuff though

nah my man
Ada safer, better at concurrency, more features, much more readable, easily maintained, more suitable for real-time applications etc etc
the only thing pascal is used for is stuff its unsuitable for
pascal is also very minimal
pascal is a language for children

Thanks I will remember that

> I got those C fags now

b-but i don't want to use OOP bjarne
please let my family go

>his view on programmers and developer culture
I believe this is still completely relevant.
>the actual language
A lot of the criticisms of C++ now apply 10-fold to what they used to.
>2) Linus is a twat
Nice actual ad hominem, fuckface.
>3) Linus has programmed in C++ himself for other projects
If you're talking about that dive log program, I'm pretty sure that's just there because it uses Qt.

>C white night status
>PROTECTED

>mostly maintenance of old stuff
Which is a disadvantage to using it.

>hitler dubs again

It has grown incredibly, but every project of that size and age would be hard to maintain after a while. It's the simple laws of complexity and software engineering, nothing to do with C.


I have no problem with Ada, it's a little bit anal about some things where C feels more "flowing" to me, but Ada has a beautiful syntax. Too bad nobody uses it (unless you count some exotic stuff like F-22).


Not true. "Costs" can mean a lot of things, i.e. it's way harder to learn Rust than C. Also Rust is young and immature, they will probably deprecate some things in the future and find more problems.
Furthermore Rust is over engineered. That's why why Go (which is sharing the C philosophy) is getting traction and Rust is not.

>Linus has programmed in C++ himself for other projects
This hurts a C tard

YOU ARE NOT GAMES.
IT AM WRITE ARE THE DO GAMES WITH AN FOR OOP.

VERY NICE REFERENCE TO MEME!!!!
(you must use oop to write game)

>you must use oop to write game
I am paid to do so...

YOU ARE EQUIVALENT TO MONEY

>C manlet angry again

Rate my tail-recursive reverse, /dpt/!

(define reverse
(lambda (list)
(define reverse-in
(lambda (tsil list)
(cond
((not (null? list))
(reverse-in (cons (car list) tsil) (cdr list)))
((null? list)
tsil))))
(reverse-in null list)))

Take your autism pill, C Tard

>C++ can't even handle infinitely recursive self instantiating types

USE C++ TO WEIRTE AN GAME.

AM GAME WRITE!!!!!!!!!
(GAME)

#include
using namespace std;
struct node
{
int data;
struct node *next;
};
void insert(struct node **head,int x)
{
struct node *newnode= new node[sizeof(node)];
newnode->data = x;
newnode->next = *head;
*head = newnode;
}
void display(struct node *head)
{
while(head!=0)
{
cout next = newnode;
newnode -> next = 0;
return newnode;
}
}
int main()
{
struct node *head = 0;
int n=10;
while(n!=0)
insert(&head,n--);


display(head);

reverse(head,&head);
display(head);
return 0;
}

You can create a compiler in C++ for your language which handles infinitely recursive self instantiating types

>tfw your infinitely recursive self instantiating type language can't even handle mixins

C people are mentally ill, aren't they?

MEME

but i can do that in any other language too

>mfw the AST for that language you are speaking of cannot be written in HOAS in C++ because to do so would be an infinitely recursive and self instantiating type

>mixins
this isn't the 90s
nobody wants your struct++'s

>I believe this is still completely relevant.
Then you are the one adhering to an ad hominem. If your problem with C++ is not the language itself, but some preconception you have created yourself as a result of residing within your safe bubble about a community you know nothing about, then that is the true ad hominem.

>Nice actual ad hominem, fuckface.
That's not an ad hominem

the-orbit.net/lousycanuck/2011/09/15/what-is-an-ad-hominem-what-isnt/

>heaps of people use Ada
>tfw sjw meme language has a bigger community

Just talk to a doctor and say C has given you chronic autism

>but i can do that in any other language too
Yes
Why argue then?