/dpt/ - Daily Programming Thread - Real Programmers Edition #14

What are you working on, Jow Forums?

Previous thread:

Attached: Gary_Kildall.jpg (657x783, 125K)

Other urls found in this thread:

harmful.cat-v.org/software/c /
github.com/Mark-Weston/platformer/blob/master/state.h
godbolt.org/g/mXeG84
twitter.com/NSFWRedditGif

Java and C *both* a shit

Even the best can not completely avoid buffer overflow vulnerabilities in their C programs. At least not without constant code auditing.

>C hackers swarm to defend their oh so precious language
>*screeches*
>post a shit copypasta from linus who made shitty agruments himself

Be prepared.

That's key. Keeping track if you access out of bounds.

>>be prepared
>implying this wasn't a bait to begin with

For the love of all that is holy, if you are working on a project that anyone else will have to use then model things properly, don't use faulty or leaky approximations.

It's just something I have seen over time on this board. If you start thinking in anyway shape or form that C might be bad language you get swarmed by C hackers who tell you how C++ is so awful and post that stupid fucking troll post from Linus.

It's the same with Java, C#, C++, Python, JavaScript, Nim, ...

Can anyone help? I got a .chm but can't find pdf

Yes, there exists C++ elitism but I see the C hacker syndrome more often.

>C++ elitism
Seems more like myopia to me.

Here's some fun C++ bashing you might have not read before.
harmful.cat-v.org/software/c /

>look at all these le witty single line quotes shit talking C++ absolutely BTFO
It's only been linked on Jow Forums 9001^2 times

public void Deactivate(bool instant)
{
_isActive = false;
_killed = instant;
}

>Alternatives: Go
Talk about throwing the baby out with the bathwater

>make a meme list about supposedly harmful things
>people take it actually seriously
>realise you did more harm than good
>end your life
preddy gud story

I've had enough of dealing with badly designed legacy systems. Sod this for a game of soldiers. I'm going to go work on an alpaca farm instead.

I haven't tried it but I think I'll like it.
Manual memory management, string management, (de)serialization, vectors/maps are stuff that I waste most time with C.
The trade-off for me would of course be the slight performance penalty, and more importantly, worse portability.

The restrictive type system is a blocker for me.

It's already been debunked by somebody else. Please stop posting that shit here. It's worse than what Linus spewed from his mouth back in 2004.

>go baby detected

lol no generics

Honestly just master c++. If you are good with c++ you can do anything. Writing safe code in c++ is easy too if you stick to modern cocncepts and folow afew rules.

Never use raw pointers
Never use new unless in constructor and then only with smart pointer
Always use smart pointer
Always implement rule of 5
const everything

>people who after denouncing Java in the same breath recommend C# like it's the second coming
I mean yeah, it's better, but it's not *that* good

>tfw Stroustrup is now almost 70 years old and probably won't write a new edition of his book covering C++14 or later

Attached: sad.jpg (209x234, 8K)

Remember that you're talking to somebody who posted an article that was debunked a while back.

C++ is deprecate, use Rust

rust is literally gay

>C++ is deprecate
No you tranny faggot thigh-high socks wearing sack of shit. Rust isn't even close to the level of C++. The fuck you on about.

Can't wait for C++21 and the rule of 7

Maybe if you have to change your language so much so often, it's a symptom of something

Well as I said, I haven't tried it.
But this is what I'm talking about:
github.com/Mark-Weston/platformer/blob/master/state.h
There are 12 structs in the form of "typedef struct { int n; SomeType *arr; }"
I'm not comfortable with a language that has so many features. There may be better ways to do things using the features that I'm not even aware of.
Also more people could contribute to or become interested into my projects if they were written using a language that is simpler.

I think you're both laboring under some deep misapprehensions

>C++ is deprecate, use Rust
Also it's the year of the Linux desktop, am I right?

What extra copy control members are they adding? Last I checked, they weren't.

Rust is defecated, use Typescript.

They're not

Exactly.

What? Me nah. I use Rust a little bit.

Typescript is a soiled band-aid, use Elm or PureScript

How do I compile a C++ program on windows for linux?

Attached: 1530991338510.png (680x521, 94K)

We don't use DOA tools here sweetstuff.

Use g++ or clang++ or another c++ compiler.

It was a joke about how C++ best practices keep changing, and how perhaps the language is simply a badly designed hodge-podge at this point trying desperately to stay relevant by bolting on more and more features (with many subtle interactions with each other that can blow up in your face if you're not careful) which also makes it hell to stay on top of as a developer

I already use clang++.

They're in use ergo they cannot be DOA.

>website about (((harmful))) software
opinion discarded, even if i agree with parts of it

t. harmful software addict

You don't. Seriously just set up a virtual machine and build in there, cross-compiling to Linux is way more trouble than it's worth thanks to GNU ld.

To add to that, I'm not comfortable working with a tool that I could never possibly be able to grok. There are hobbyist C compilers. There are hobbyist Lua interpreters. I suppose you could make a Go compiler in a reasonable time frame. You can create a POSIX-compatible make in less that a week. POSIX shell is not too hard to implement as well. Most POSIX utilities are pretty simple as well.

C++? Good luck with that.

What is harmful software and who was the faggot who created the stupid shit?

>(((Jow Forumsack))) NEET thinks his zero iq opinion is worth anything

>Java
>everything is an object lol

>brainlet
>can't into OOP

I realize that perhaps for you OOP is the limit of your ability

desu if OCaml supported multithreading properly there'd be no reason to use Java any more

Sometimes I wish that every poster on /dpt/ would be required to link his personal project portfolio before posting.

By whomst'dv'e? Clarissa your left hand and Monica your right hand don't count as clients.

java really sucks to use desu

anonymised portfolio pages with a linked trip would be a fun side project

We would probably discover than every Haskell/Lisp/OCaml/other-functional-memelang preacher has only fizzbuzzes and SICP exercises

tell me why i shouldn't spend time on common lisp

Attached: 1528047574330.jpg (800x864, 160K)

Here's my portfolio, cleaned up from yesterday. I think you'll agree that it's quite excellent.

import Data.List
import Data.List.Zipper as Z (toList, duplicatez, fromList, Zipper(..))
import Data.List.NonEmpty as NE (nonEmpty, toList, NonEmpty)
import Data.Bifunctor
import Control.Monad

anyPartitionsWithEqualSums :: [Integer] -> Bool
anyPartitionsWithEqualSums = maybe True (or . ((.) . fmap) (uncurry (==) . bimap sum sum . (\x -> case x of Z.Zip l r -> (l, r))) ((Z.toList . Z.duplicatez . Z.fromList)

checks out

because sadly there are very few common lisp jobs these days

It's neither a fizzbuzz nor a SICP exercise, to my knowledge.

It's of equal value.

Well, I suppose it is a somewhat pointless function.

>sadly

dumb frogposter

>or . ((.) . fmap)
This is just
or . (fmap . fmap)
aka
or . (fmap `fmap` fmap)
aka
fmap or (fmap fmap fmap)

noob here. only ever done some shell scripting and html/css. If I want to learn python, which version should I choose, 2.7 or 3? also, does learning python mean I'm a faggot? thanks

Attached: 1530222305274.jpg (474x712, 129K)

3, python 2 will be not be maintained after 2020
Yes

>which version should I choose, 2.7 or 3?
3.

>does learning python mean I'm a faggot? thanks
A massive faggot actually

>Yes
>A massive faggot

I want to blit 2d images around in a window and make a retarded 2d game. what should I choose instead of python? I'm on jewbuntu, btw.

Attached: 1530134115452.jpg (1200x1286, 351K)

>I want to blit 2d images around in a window and make a retarded 2d game
honestly python with pygame is the easiest way to make 2d games that I've come across

Why isn't Haskell more widespread in real-world production software?
If it really is so much more powerful, Haskell programmers could compete with ease and become filthy rich.

*out of the traditional languages
I assume gamemaker is the easiest, but I haven't tried it myself

Java marketing
Companies don't want to pay 5x for a 10x programmer, they'd rather pay 10 lots of 1x for 10 1x programmers

Start your own company and beat the competition with brilliant Haskell code vs their Pajeet Java.

Whatever that visual novel maker is called would be easier. Actually I think the most popular one is made with python.

That's the plan when I finish building up enough starting capital.

I think the problem is that traditionally few developers have been haskell users, so if you're making a project that will be developed by 100+ developers you have to assume some of them will never have touched Haskell or even functional programming.

But fp is becoming larger now so I think we'll see a rise in Haskell use

It's called renpy. If you consider visual novels 2d games, then yes, probably. But I assumed he wanted something more involved than visual novels.

I wonder why nobody before you has ever done that
Probably because they're brainlets

keep dreaming idiot you're gonna be workin' retail for the next decade

Attached: 0002.gif (440x440, 2.48M)

They sell well enough and provide you with some experience. But yeah if you're talking about 2D games relating to movement on screen within that 2D space, gamemaker would be the preferable choice.

arr[i] &= VARIABLE_MASK;
Is something like this automatic and thread safe?

I managed to get the ears and eyes onto all of the bodies.

Also I wrote a auto-player to play against me in my "push your luck" random number game.

Attached: on point hares.png (1079x1003, 348K)

Exactly, do this. If you want people to use FP, then prove that it is better, don't just claim it.

>yet another retard++ nobody claiming Linus is wrong despite his knowledge and success

Doing some fun stuff with twitter streaming samples api.

Apparently they're doing to remove them in less than a month?

>automatic
Can't tell what that is supposed to mean in this context

>thread safe
x86 can definitely atomically do an atomic bitmask with LOCK ANDL

Honestly, Haskell becoming the face of FP is probably the worst outcome of all.

Haskell isn't widespread because a) there aren't a fuckload of developers who use it and b) it's difficult to learn or, certainly, difficult to master. The only real reason why other FP languages aren't heavily used is because of the lack of developers and support/libraries: in terms of simplicity, ease of use, expressiveness, and many other important FP qualities, those languages are at least as good as Haskell. But Haskell nonetheless reigns, and it's a goddamn cancer to a pure/mostly-pure functional programming language ever becoming dominant.

>Why isn't Haskell more popular?

Looks like the real answer to this question is that Haskell users are literally retarded:

>I think the problem is that traditionally few developers have been haskell users

>Haskell isn't widespread because a) there aren't a fuckload of developers who use it a

Attached: 0008.jpg (560x560, 77K)

animeposters may leave the thread now

no u

Attached: 0002.png (520x632, 278K)

It's not more powerful. Lazy evaluation makes it too difficult to reason about large scale software and larger projects are untenable. Haskell is a giant meme and holding FP/ML style languages back at this point.

I meant "atomic", of course.
>x86 can definitely atomically do an atomic bitmask with LOCK ANDL
But what about the assignment - that doesn't happen in-place, does it?

lazy evaluation is the only sensible approach in a non-total language

>that doesn't happen in-place, does it?
If you just write it like that, it will not happen atomically.
You could do it this way if in C
godbolt.org/g/mXeG84

If C++, use #include and convert the array to an array of std::atomic

What am I in for?

Attached: 2018-08-02-025218_454x555_scrot.png (454x555, 317K)