/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Old thread:

Other urls found in this thread:

pastebin.com/RJtqRKSm
cs.cmu.edu/~15122/schedule.shtml
cs.cmu.edu/~15122/handouts/03-arrays.pdf
twitter.com/AnonBabble

"The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages." -Richard Stallman

thanks for using an anime image!

>posting leftist garbage
remove yourself

>posting Sup Forumstardisms
remove yourself

>Sup Forums
yeah, you can fuck off to that left wing board for all I care. just don't pollute this thread with your garbage.

...

>garbage
>animu tho
the mental illness is real

how was that in any way a response to what I just said? are you this awkward and autistic in real life as well?

>let me prove my mental illness
called it!

>just don't pollute this thread with your garbage
>said the Sup Forumstard

that's literally not even a valid response to what I posted.
how can i be anti-leftist and from Sup Forums at the same time? are you seriously this autistic?

>reeeeeeeeeeeeeeee muh animooooooooo
lad...

>turboautists still arguing
Another day, another /dpt/.

I don't fucking care who are you, anti-leftist or pro-leftist, these are political terms which have no place outside of their containment boards.
Here's a link for you:

/dpt/ attracts Sup Forums and /x/ hilariously enough the act of programming has beneficial concepts for both of them. Legitimately on some level a lot of the mysticism from /x/ translates directly into mathematical and logical algorithms that can be used to solve problems. As for Sup Forums guess what our computers with the current trend of advancement will shortly (History wise) be biological.

>using Sup Forums culture incorrectly
so you are a "redditor"?
got it.
you do realize the inherent retardation in sending an anti-leftist to a left wing board, right?
>these are political terms which have no place outside of their containment boards.
in which case you should make a new post replying to the second post in this thread (the one between two anime pictures in the beginning).

>muh mental illness is a culture

>muh
>being a filthy immigrant who doesn't want to integrate
i don't want "reddit" stink nearby. fuck off already.

>in which case you should make a new post replying to the second post in this thread
There's nothing political in Stallman's quote, just plain lispfag words.

>mental illness 4lyf!

a stall"man" quote is by definition a political quote. i know you want to try and deny it to save face, but that won't work here.

How can tracing garbage collection be faster than reference counting? Isn't the difference that with a tracing garbage collection you pay a big computational price "P" once, whereas with reference counting you pay "P" over time?

>I'm by definition mentally ill tho

>4lyf
what kind of mangled version of English is this?
do they usually speak like this on "reddit"?

>"what kind of" pretending
cmon lad...

Fuck you I will learn and use C++.

who are you quoting?

>le confuseled about quotes meme
animoooooooooooooooooooo

Jesus fucking Christ, can we just delete this thread and start again?

I see nothing but plain lispfaggotry. You were the first to call it a political quote. Thanks to you, you brought politics in this ITT thread.
Delete yourself.

>DELET DIS

who the hell are you quoting?
>I see nothing but plain lispfaggotry
look a little lower, there should be a certain leftist name somewhere nearby.
>Thanks to you, you brought politics in this ITT thread.
that's as retarded as saying the person who responded with "remove yourself" to a Lenin quote is bringing politics into the thread.

>this ITT thread
9GAG ARMY!

I don't know what that means, but I'm not getting involved in this madness.

>who the hell are you quoting?
the mentally ill apparently

A simple language-agnostic syntax highlighter for an imageboard.

who is "mentally ill"? does he need our support?

>I'm this new

Who art thou quoting?

>who is "mentally ill"?
the one I'm quoting, pay attention, dumb fuck

I've been here since before /dpt/s started, but if it's not from Sup Forums, I don't know the meme.

me? what the fuck?

>if it's not from Sup Forums, I don't know the meme
all memes start on reddit and 9gag tho, there are no Sup Forums memes

>9gag
is this another imageboard?

That'll be why I don't know them, then.

>>I see nothing but plain lispfaggotry
>look a little lower, there should be a certain leftist name somewhere nearby.
leftists can't say anything without it being political or what

scheme is better than your language

>to a Lenin quote
Lenin was a programmer?
His words would be completely irrelevant to the *programming* thread since computers didn't even exist back then.
But Stallman was.
Or using Emacs and GNU/Linux or as Stallman refers to it, GNU plus Linux is a political message now?

>gnu
>emacs
you are literally committing white genocide rn

>insisting on confusion meme
the gig is up lad

I need some ideas for where to put my registers for my RGA video device, and what they should do.

what are you making exactly

A VM for an architecture I came up with. The CPU is somewhat done(as in it's functional), and now I'm working on peripherals.

>Lenin was a programmer?
i believe he would be a member of the FSF right now, yes.
>His words would be completely irrelevant to the *programming* thread
so he's just like stallman?
>But Stallman was.
uh... no?
>Or using Emacs
not necessarily.
>Shit/Linux
yeah, referring to it in that manner would certainly make you one of them as far as any sane person is concerned.

What's your instruction set like?

It's like if MIPS, x86, and PPC had a horrible child.

Awesome. Post some of it.

i imagined something along those lines
just be yourself and get registers as you need them, maybe write on a piece of paper what you need

Anyone experience with multithreading in C++?
I made a thread pool and built my own parallel for loop on top of it. Takes loop parameters and a lambda as an argument.

The thing is. It keeps deadlocking. Most often happens when I'm running it with 1 thread (i.e. the pool has 1 thread that it runs the loop on, which is a different thread than the main thread). I have no idea why it's doing this. My suspicion is that it may have something to do with the lambda (or functor object rather) that could possibly be outdated in a thread's local stack, but I am far from sure about that.

It's slightly faster (for my needs) than Microsoft's concurrency::parallel_for from the PPL and since I need maximum performance and I like portability I'd rather fix this than resort to that.

Anybody wanna take a look?
pastebin.com/RJtqRKSm

>i believe he would
There's no beliefs right now, he's not relevant to the programming and that's the fact.
>uh... no?
Don't pretend.
>referring to it in that manner
Seeing the stale pasta is a lot better, you think?

the assembly looks like
mov r2,255
mov r0,8
push8 r0
pop8 r1
st byte,r1,r2

which would store 8 into address 255
the actual machine code would be:
15 41 00 00 00 FF 15 01 00 00 00 08 36 00 34 20 0D 08

woah human assembling

You don't learn C++, you endure it.
No one in their right mind would teach themselves C++ without being forced to use it.

>tfw being a programmer 50 years ago literally meant to be a human assembler

It was a time when men were men and computers were toasters.

>There's no beliefs right now
but that's true. he would be a member of the FSF right now. I know that for a fact.
>Don't pretend.
yeah, i never pretended. i'm just stating the truth.
>Seeing the stale pasta is a lot better, you think?
>being this scared by leftist faggots
>not wanting to call shit software what it is

Has anybody a recommendation for a graphics library for c?

SDL

Rolling my own NFA regex implementation.

Lisp with cl-sdl2

In the Art of Computer Programming books Knuth talks about his summer's spent writing compilers in the 1960s for vastly different architectures since there existed no standards at the time so he would frequently write the same compiler in 6 different assembly languages at the same time. That's why he laughs when people complain about MIX (now MMIX) being in the book as 'yet another language to learn' because he had to be able to learn a new language in a couple of days in order to pay the bills back then.

python retard here, lets say I have
#!/usr/bin/python3
def start():
global one
one = 1
second()

def second():
global one
one = 1+1
third()

def third():
print(one)

start()


instead of doing global each time can I sort of send one from start to second then to third? is that better or is global each time fine?

its because language nowadays have so much more features than just functions and loops

assumig you forgot 'global one' in third(), otherwise that shouldn't work at all I think
def start():
second(1)
def second(n)
third(2)
def third(n)
print(n)
start()

would accomplish the same (as would print(2))

>assumig you forgot 'global one' in third(),
no it prints two, your way works though, thanks

Having is little global state as possible is a good thing, so someone along the chain of calls you make doesn't suddenly mutate that state with garbage.

oh yeah forgot how globals worked there for a second

Haskell

it's a shame there's no support for haskell and QT

There are a few QT libraries for Haskell.

other than FFI bindings i mean

How do I duplicate and double an array in C#?
By that I mean, how do I write each n from array1 to n and n+1 in array2?

Well that's because it would be slow as fuck.

They all compile to the same assembly/machine code though

But Haskell is QT!

You're right user

You -> Me -> Love ()

int[] shit = new int [] {1, 2, 3};
int[] feces = new int [shit.Length * 2]

for (int i = 0; i < shit.Length; i++) {
feces[i] = shit[i];
feces[i+1] = shit[i];
}

Don't you have to increment by 2 then?

Look through these lecture notes:
cs.cmu.edu/~15122/schedule.shtml

Specifically this lecture under 'Aliasing Arrays' shows you a few methods how to copy safely cs.cmu.edu/~15122/handouts/03-arrays.pdf which you can translate into C#

Yep. Disregard.

Use 2*n and 2*n+1 instead.

Also, wouldn't you get an out of range exception? shit[6] = nonexistent.

Well in that example, the length would be 3, so the for loop just goes from 0 to 2.

I have a question about powershell and WSL.

When trying to get stdout from a bash call I instead get errors.
$text = bash -c "echo success"
$text
E r r o r : 0 x 8 0 0 7 0 0 5 7
What I'm doing right now is write to a file on the Linux side and then read the file in again on the windows side, afterwards deleting the file.
This is quite annoying.
Anyone here that managed to work with text output from WSL commands?

After some more googling I found this issue to be a problem with WSL on the current Windows 10 stable version. The latest insider builds do have working shell redirection.

Guess I can wait a few months.

Syntax now highlights live. There is something magical about watching code appear as it's typed.

Does it report syntax errors like newline braces?

GNU*

>literal trash
ftfy

Hell no. It doesn't even detect language. Just some lightweight highlighting akin to the code tags on Sup Forums.

what about languages where none of those are keywords and // isn't a comment?