/dpt/ - Daily Programming Thread

Previous thread: What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=_6HT_AqXL-o
multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/
cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf
twitter.com/SFWRedditGifs

Not sure whether to post you guys a question I made

foo = new Foo(1);
foo = new Foo(2);
delete foo;


I've only deleted the second Foo now, and the first one is still floating around in memory without a pointer. Is that right?

No. This is very wrong.
You should be ashamed.

Yes.

Well that's why I posted it. What's the right answer then, user?

so I have a folder filled with 20+ scripts all made by 10+ people (some made by me) would it be scummy to compile them all into one script and put it on my github (assuming I give credit for everything not written by me)

it's my first ethical dilemma, I mean one unified script would be very useful to me ( and a lot of people) but is this a scummy thing to do?

Depends what language this is.

Yes. This is very right.
You should be proud.

Why is Java (and to a lesser extent, C#) considered a Pajeet language?

C++. Should've specified that I forgot other OO languages existed there for a sec.

Seems right to me though, since the pointer isn't ref counting it wouldn't implicitly free the old memory right?

memes and jealousy

Because even the IDE lags while u code if your brain cant sense this delay compared to something like VS or Vim you are literally Pajeet tier

...

>I've only deleted the second Foo now, and the first one is still floating around in memory without a pointer. Is that right?

Yes, all calls to new must be deleted. Foo(1) would still be on the heap without any pointer to it in your program.

yes way

only if you have too little RAM

no, java IDEs and anything that runs on Java just feels like every its going to crash and spawn a black hole every WndProc

lol k

Then yes, the first allocation will not be freed.

nice bait u fucking CIA Nigger
>2014 benchmark based on 3 for loops and 1 add instruction

Java is an enterprise-tier language that gets farmed out to the lowest bidder in (literally) shitty countries like India. Very few people will code in Java on pet projects because they enjoy the language.

...

source for this graph?

Try it with Scala... I'm often half a minute ahead of the IDE. A significant amount of the time it fails completely to realize an expression typechecks.

blog.carlesmateo.com/2014/10/13/performance-of-several-languages/

LMAO
just looked it up
seems like you are correct

I haven't done any personal/pleasure programming since I got a job as a software engineer.
Is that typical?

Fuck you m8.

You've clearly never used IntelliJ.

I'm not sure but, would this work?

unsafe{
fixed (int*** parr = new int**[9]){
for (int i = 0; i < 9; i++) {
fixed (int** a = new int*[9])
{
parr[i] = a;

}
//parr[i] = new int*[9]; //this part doesnt work
}
for (int i = 0; i < 9; ++i) {
for (int j = 0; j < 9; ++j) {
parr[i][j] = null;
}
}

}
}

feels good doesn't it

youtube.com/watch?v=_6HT_AqXL-o

it sure does
are there any militias forming already to deport h*llary and her supporters?

>ruby outperforming python

Trying to figure out if my overlay blend mode is actually working correctly.

Are those bell peppers?

fucking newfag

Terry is streaming btw

Yeah don't link it or anything.

Ok I won't

Sorry i forgot there are javascript programmers on here that have < 100 IQ and cant search for youtube templeOS

>Google this pic.
>Get .Net framework results.
wew

That is correct. The memory initially allocated in the first call to new is no longer accessible, but still allocated. We call this situation a memory leak. Over time, a memory leak can grow as new memory is allocated and not freed in successive function calls. The solution is to pair each new to a delete, and each malloc to a free. Of course, this can be tedious to remember, so in C++, there's two alternative solutions. One is to simply use stack memory, rather than heap memory. If the size of the data can be bounded to a small enough amount, the stack can be a rather fast method of obtaining memory. Alternatively, one can encapsulate a pointer inside of some sort of struct, and merely write constructors and destructors to handle memory allocation for one's self. RAII automates this process by calling an object's constructor when it comes into scope, and its destructor when it leaves scope.

not those delegates, dahnald

Chill out nigger, it's not like I'm autistic enough to know all the memes.

Posted from other thread:
Writing a CHIP-8 Emulator to practice over the weekend, but have absolutely no idea about OpenGL, SDL, and DirectX
Using this guide,
multigesture.net/articles/how-to-write-an-emulator-chip-8-interpreter/

And I have no idea which books/references I could use to read up on them... I tried the OpenGL SuperBible, but that's written for Windows (would it still work for Mac, despite it using Visual Basic)?

Thanks in advance!

gnu is my pepper

WHERE WERE U WHEN TERRY SENT CIA A LETTER TO SURRENDER BY DECEMBER 15TH

...

This is some fucking crazy shit right here m8s.
Mental illnesses are scary.

>he doesn't even use his own OS

Which one of you faggots keep calling him?

it's those CIA niggers

well shit. it worked.
and here i am 2 hours in trying to find a workaround

How does it feel to know that this fucking nutcase has achieved more than you ever will in your life? Are you as ashamed as I am?

Someone call terry and tell him to turn the cam back on

>kids' zone
lmao

cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf

Why haven't you read this paper yet, /dpt/?

Why haven't you embraced functional programming, /dpt/?

I have.

Dependent types, higher-kinded types, all feel so natural to me now.

because it's shit

Functional programming is, and I say this unsarcastically, not any more intelligent than any other form of programming. In fact, you could say it's the opposite.

Okay, started trying to program with OpenGL, and asked XCode to link the OpenGL Framework, but it isn't being recognized (see pic related for the error)

Functional programming is DRY taken seriously.

Any emacs users here?
What kind of environment do you guys use for C programming?

Right now, I am using irony-mode for autocomplete, and flycheck for showing errors and warnings, and gtags for jumping around with GLOBAL tag files.

What do you guys do? Any cool packages you all could recommend?

@57690752
why would anyone use that piece of shit "software"?

Just use CLion.

>indexed monads
has strongly typed pure FP gone too far?

Indexed monads are perfectly natural.

who /verilog/ here?

monads are a social construct

monads are endofunctors in the category of monoids

my pajeet software development 2 professor who can barely speak english keeps making fun of haskell and functional languages

I've read part of it. I have it on my computer at least

is terry like this everyday?

yes
which means they are a social construct

Realistically, these extensions should all be enabled by default:

GADTs, TypeInType, KindSignatures, RebindableSyntax,
NoMonomorphismRestriction, ConstraintKinds,
ExistentialQuantification, RankNTypes, TypeFamilies

__maybe__ NoImplicitPrelude

Type and Constraint should be in Prelude

There's really no excuse for not enabling them

indexed monads aren't

Why don't you tell him why he's wrong? For example:
>haha you just hate fp because you're a brainlet pajeet
>look at my code golfy one-liner

Implement monads in his favourite language.

haha you just hate fp because you're a brainlet pajeet
look at my code golfy one-liner

main = interact (unlines . map (unwords . reverse . words) . lines)


>readability edition
withLines f = unlines . f . lines
withWords f = unwords . f . words
main = interact . withLines $ map (withWords reverse)

You can't implement monads in C# or Java

>

in fact C# has LINQ so you're literally wrong

selectMany is >>=

vgl.h is not in the same directory as main.cpp

>go and java are faster than c++ and asm

right

>how to know your test is shite, loops edition

He's right tho FP is just for niche applications and mostly basement neets

how do you assess?

what about

that looks awful and slow

Just BTFO him like you do all successful and productive people user! Call him pahjeet, and say that you can write anything in FP, just because you haven't, you're just more intellectual and understand, it's totally not that pure FP is unsuitable past math algorithms and fizzbuzzes!

Needless complexity, in all real-life applications you can eyeball it and see that it's not broken.

it's just an example, and needn't be slow, especially since that transformation (FilePath -> FileIO Clsd Clsd ~> IO) could be done at compile time
the typechecking is clearly at compile time

that's just one example

converting my C++ wxwidgets project to a C GTK+ 3 project like an absolute mentalist

feel my willy getting stiff just at the thought of this profane and unnatural conversion

alright, show me an example that is actually useful in real life and couldn't be written in a better way using a normal language

Tfw can design for web, but can't wrap my head around shitty languages like PHP for Wordpress.

If someone asked you what the general design of your program is how would you respond?

going through the slides posted online to fill out my study guide. this one's a gem

Functional versus imperative style
• What is a purely functional method? Why would
you want to use one? How would you define it?
How should it behave? Examples?
• What is a method if it isn’t purely functional?
What does this mean? How would you define it?
How should it behave? Examples?

this is basically all of what the slides are

MVC

use asp.net
>inb4 pajeet

Tfw I'm on a Mac.