/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1539914721322.jpg (600x600, 63K)

Other urls found in this thread:

tools.ietf.org/html/rfc8369
tools.ietf.org/html/rfc1149
tools.ietf.org/html/rfc2324
youtu.be/e8MbwOfS6kA
youtube.com/watch?v=2Op3QLzMgSY&list=PLE18841CABEA24090
doc.rust-lang.org/std/primitive.u128.html
gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html
gcc.godbolt.org/z/UXH1KX
godbolt.org/z/gAlz4x
github.com/rust-lang/rfcs/blob/602f146e46f9d79087ce36d0bf431475f0778509/text/0000-add-cow-to-prelude.md
twitter.com/SFWRedditGifs

I'm a lewd little slut, please give me likes!

Attached: 1535977404883.png (575x800, 330K)

not programming related
reimplementing libc and cheating a lot

Attached: 1553209123919.png (1000x793, 717K)

can you post that chart with a list of programming task of various difficulties from fizzbuzz to compiler? I think it was one of the "last digit of post number decides" things

no, disliked

No, but i have read the k&r book

In other words, structs?

Attached: struct.png (800x491, 23K)

This post is retarded and wrong and doesn't even reflect reality so fuck off.

Remember to like and subscribe to this post.

>class
>tuple
>data structure
>function
>exception
>return value
wrong
>loop
>template
>pointer
correct

so, just like a struct

Post April Fools' programming jokes.

Rust
Go
Haskell

tools.ietf.org/html/rfc8369
tools.ietf.org/html/rfc1149
tools.ietf.org/html/rfc2324

Attached: 1538863559652.png (550x550, 197K)

I wish I had a yukineko to keep me company while programming.

Why does C++ still lack trailing types for non-function declarations?

youtu.be/e8MbwOfS6kA

youtube.com/watch?v=2Op3QLzMgSY&list=PLE18841CABEA24090

Rolled 6 (1d6)

Just posting here so I can see what the dice+1d6 perk does.

Is there a Nim "full course" like there's 50+ of C++/Java/Python?

HOW DO I INTO 128 BIT MATH
I DON'T UNDERSTAND HOW TO MULTIPLY NUMBERS AND GET THE OVERFLOW INTO A SECOND VALUE

doc.rust-lang.org/std/primitive.u128.html

I don't want to use rust.

You should try it, it's very good. Otherwise, just use gcc.gnu.org/onlinedocs/gcc/_005f_005fint128.html .

I also don't want to use gcc. I just want to understand how this shit is supposed to work.

Attached: brainletinu.jpg (811x1082, 180K)

What is so hard to understand about it?

It's just fucking simple primary school arithmetic, jesus christ.

I'm working on my hobby OS, but I've been frustrated lately. I'm taking a break for a few days.
I've been reading through TempleOS and the compiler that comes with it. This code is pretty terrible, isn't it? Terry Davis really likes to redundantly iterate over arrays.

when you multiply two numbers the resulting value can be higher than you can fit in the same number of bits. 2^64 * 2^64 = 2^128

so when you do it, it'll return a wrapped-around value right? or maybe it'll clamp it, I don't even know what will happen, but I don't see how I can get the upper 64 bits back. or how it'll work with signs.

the CPU just places the upper 64 bit in a seperate 64 bit register if you ask it to do that

well he was schizophrenic

LIKE AND SUBSCRIBE TO
>THE C PROGRAMMING LANGUAGE
>>The C Programming Language
>>>THE C PROGRAMMING LANGUAGE🥛

gcc.godbolt.org/z/UXH1KX

brute force is too slow, you want to use native instructions as much as you can. gcc does it but I don't know how it works at all.

but how do I get it back? do I need to use assembly? I don't know that.

Looks like the trash bin emoji
Would make sense

> C programming language is a glass of cum
really makes you think

it really makes me drink

Attached: mai waifu.png (298x440, 94K)

>but how do I get it back? do I need to use assembly? I don't know that.
if your language doesn't support it I guess you'll have to use assembly. if you can use gcc, check godbolt.org/z/gAlz4x

Attached: 1523427045515.png (850x1205, 1.16M)

♨️

Attached: 1523700492466.png (524x928, 323K)

>brute force is too slow, you want to use native instructions as much as you can. gcc does it but I don't know how it works at all.
As I said, it works like primary school arithmetic, you just do it in N bit chunks.

🥒

Attached: 1538507272910.png (700x910, 243K)

wait if food is a pickle then what's pickle

Attached: 1527891661330.png (850x1510, 583K)

oh. I regret checking🐰

Attached: 1524620097359.png (1481x2003, 3.77M)

what is this❤️

what language would even support something like that?

Why don't you reverse image search and find out

Attached: 1545150039054.png (708x1000, 768K)

woops it was bricks not brick
alright I'm done now

Attached: 1525578964294.jpg (1000x1201, 152K)

I have a panel inside of another and the inner one draws on top of the outer one, any way to prevent this /dpt/? I'm making a windows form app

Attached: file.png (673x382, 6K)

I don't understand any of this. Please be patient.

Like any other bit math, retard.

set(JOHN_NAME "John Smith")
set(JOHN_ADDRESS "123 Fake St")
set(PERSON "JOHN")
message("${${PERSON}_NAME} lives at ${${PERSON}_ADDRESS}.")

Why didn't Cmake devs just use Lua or something instead of inventing this silly, silly language?

?

If your going to delete then at least be consistent and delete and too, silly janitor.
Inconsistency is bad moderation!

Attached: 1525558101048.png (1273x1800, 2.42M)

You can't spell trust without rust.

Im trying to install haskell and keep getting this gosh dang error;

Downloaded lts-13.15 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""

github.com/rust-lang/rfcs/blob/602f146e46f9d79087ce36d0bf431475f0778509/text/0000-add-cow-to-prelude.md
It's funny because it's true.

Attached: Screenshot_2019-04-01 rust-lang rfcs.png (926x532, 48K)

I have this function

int compare(char* f1, char* f2, int n) {
int i = 0;
while( i < n && f1[i] == f2[i] ) {
i++;
}
if(i==n) return 1;
return 0;


the task is to make a recursive version and this is the best I can think of

int compare(char* f1, char* f2, int n, int i) {
if(n == i) {
return 1;
}
if(*f1 == *f2) {
return compare(f1, f2, n, i + 1);
}
return 0;
}


do you think there is a more elegant way?

Not in C, no.

just noticed that there is an error, but you get the idea

pretty sure you're only ever comparing the first character in your recursive version
int compare(char* f1, char* f2, int n) {
return !n || (*f1 == *f2 && compare(++f1, ++f2, --n));
}

oh that's what I was looking for

thanks

+1 and -1 would be better here, since you don't actually need to increment/decrement the arguments.

true
don't forget to leave a like ;)

don't bully my friend the janitor, there's a lot of shitposts to delete today

Attached: 1534207424049.jpg (1028x732, 340K)

I've been working on Android apps the past few months and I've been slowly coming to realize that Google is a shit company.
Shitty barely functional APIs that are extremely convoluted for simple tasks and absolutely abysmal documentation.

Whoever wrote the Camera2 api deserves eternal pain.

But I was just testing some perks!
Unfair!💢

Barring a few exceptions, interfacing with hardware in general on Android is usually an exercise in self-harm

>Android is usually an exercise in self-harm
ftfy

I have taken a look at your github and saw a program called "Automatic loli gallery downloader for sadpanda", could you tell me what this program specifically does?

Attached: businesswoman-reading-a-bad-resume-in-a-job-interview-HGG3P1.jpg (1300x956, 107K)

>not knowing what an image scrubber is
Why am I even taking this interview again?

At least they bothered looking

to get out of the toilet scrubber gig and get your life back on track

sure as fuck not gonna make a change if whoever is put in charge of deciding if I should be hired or not doesn't know shit about the job they're looking qualified personnel for.
Quite literally the mark of the pajeet

Because you a fucking neet

NEETry is not something you get out of with a job
the lifestyle takes more than that to change

C-cunny downloadu 9001!!

Attached: 1553702798840.jpg (503x436, 48K)

is this retarded
int128 mul128(int128 a, int128 b)
{
//const long mask_32 = 0x80000000FFFFFFFF;

int128 c;
int a0, a1, a2, a3;
int b0, b1, b2, b3;
long c0, c1, c2, c3;

a0 = a.lo;
a1 = a.lo / 2;
a2 = a.hi;
a3 = a.hi / 2;

b0 = b.lo;
b1 = b.lo / 2;
b2 = b.hi;
b3 = b.hi / 2;

c0 = (long)a0 * b0;
c1 = (long)a1 * b1;
c2 = (long)a2 * b2;
c3 = (long)a3 * b3;

c3 += c2 / 2;
c2 += c1 / 2;
c1 += c0 / 2;
c2 = (int)c2;
c1 = (int)c1;
c0 = (int)c0;

c.lo = c0 + c1*2;
c.hi = c2 + c3*2;

return c;
}

Attached: hqdefault[1].jpg (480x360, 20K)

Give me a like and I'll read your programming fortune🐸

Attached: 1448481666487.jpg (1147x825, 116K)

how easy would it be to put some shit together in pygame and make a semi decent simple game as a 2 month programming project of sorts for a class?
i know it's not a 'good' engine for serious gamedev in the opinion of most but mostly i'm just looking for something that will allow me to make something without having to go very in depth and i'm already kinda familiar with it

here's your fortune /dpt/

Your fortune: キタ━━━━━━(゚∀゚)━━━━━━ !!!!

hehe
developers are so funny!

Attached: so.jpg (1897x839, 255K)

why not save yourself 4 assignments and just do
c1 = (long)a0 * b0 / 4;
c3 = (long)a2 * b2 / 4;
instead?

Building a REST framework in C++
It's coming together fairly nicely and is fast a fuck

Attached: 2019-04-01-191753_1916x1054_scrot.png (1916x1054, 231K)

I don't understand, the division by 2 is to get the upper part of the number, 2^64 / 2 = 2^32 you can't just divide by 4 once instead of 2 twice.

alright just one more

Your fortune: Outlook good

Attached: 1465847812638.png (240x320, 63K)

>2^64 / 2 = 2^32

Attached: 1444337085533.png (1106x1012, 660K)

oh wait it should be max_int instead of 2. I am not clever.

>yfw PostgREST

>> 32

undefined for signed ints

sepples is a mental illness.

then if that's your goal, why not just
c1 = a.lo?

on win10
started playing with gitbash for shortcuts and not start filename doesn't work anymore, it opens the windows terminal instead of opening the file with the default programm

wat do

Try
explorer filename

you deserve a like

Yes.

C++ > C
Python > Ruby
Lua > Scheme
Rust > Go

>C++ > C
No.
>Python > Ruby
Yes.
>Lua > Scheme
No, llua is almost dead when lisp will be alive in 1000 years.
>Rust > Go
Who cares?

You could create a final_compare function calling the compare fonction with i=0 to avoid having to explicitly call it. (black box abstraction and it will behave exactly as the original version without another argument )

As nice as Lua is, don't be quick to dismiss the power of this shitty cmake language. The simple code you demonstrated contains computed variables, already shows its metaprogramming capability. It's as powerful as make. Other build systems simply don't have this power.