/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 74964290_p8.jpg (1293x1530, 1.03M)

Other urls found in this thread:

pastebin.com/gRGrB2Pp
youtube.com/watch?v=B2BFbs0DJzw
en.wikipedia.org/wiki/only_respectable_looking_guy_in_the_image
twitter.com/AnonBabble

Fuck anime and fuck japan.

[obsessive whining about language X not having meme feature Y from language Z]

That's not anime, you moron.

Attached: 1558292797934.png (1000x1000, 230K)

please use a programming image next time
haskell, type level lambdas
he didn't say it was

C, built-in string library that doesn't suck dick

obsessive whining about Pascal not having tail call optimization from Scheme

>please use a programming image next time
dumb webshit

JavaScript.

Shut the fuck up newfag I've been here for years I don't even know how to set up a fucking server

>please use a programming image next time
How is the OP picture not programming and /dpt/ related? Also, nobody fucking cares about your stupid SICP edits.

Attached: 1543312567018.png (1920x1080, 1.55M)

>hey user, show me your assembly program

Attached: cute.jpg (500x750, 188K)

hlt

mov trash yuno

The internet is vast and deep! Find somewhere else to be.

Nobody asked you :D

Is there any language that has type level lambdas?

xor rbx, rbx
div rbx

other than dependently typed languages?

it Rocks!

loop: jmp loop

Attached: maxresdefault.jpg (1280x720, 73K)

Typed Racket is bretty gud.

How are type level lambdas related to dependent types?

Depending whether that's intel or at&t syntax means putting the trash on yuno or yuno in the trash.

>C++ is bad because you can overwrite + and =

Attached: 1554840773157.jpg (500x514, 27K)

well in Agda/Idris/etc there's no problem defining a function from set/type to set/type etc and then using it inside a type

C++ is bad because you can overwrite + and =

>C is good bec-
>Program received signal SIGSEGV, Segmentation fault.

>small brain: C++ is bad because you can overwrite + and =
>normal brain: used responsibly operator overloading can make code shorter and more readable
>galaxy brain: C++ is bad because you can overwrite + and =

and many more reasons

It is from japan though, and I agree fuck touhou.

Attached: 1546662394872.jpg (600x450, 77K)

Attached: 1448131548538.jpg (736x534, 39K)

>C++ is good because it has zero-cost abstractions

Attached: 1535344105381.jpg (680x598, 54K)

Many would if they were real.

.intel_syntax noprefix

#include

.data
msg:
.ascii "Hello, World!\n"

.text
.global _start

_start:
mov rax, __NR_write
mov rdi, 1
lea rsi, msg
mov rdx, 14
syscall
mov rax, __NR_exit
mov rdi, 0
syscall

Yes, I wrote something!
pastebin.com/gRGrB2Pp

youtube.com/watch?v=B2BFbs0DJzw

>C, built-in string library that doesn't suck dick
typedef struct {
int count;
char *data;
char sentinel;
} string;
Do we agree?

Attached: 4221.jpg (1120x700, 107K)

C++ has arbitrary functions from types to types, but not lambdas (i.e nameless function expressions)

No. That's garbage.

Why does the first row in main call the default constructor?
Why does the 3rd row call the copy constructor when = is not used?

Attached: Screenshot_20190529-161022_Drive.jpg (634x538, 92K)

Post your alternative.

this

who are these people

char *
But if you're one of those length fags,
struct string {
size_t len;
char data[];
};

>char *
You basically just want a library that guarantees null termination then?

some korean guy who wrote a book
???
drunken nip
only respectable looking guy in the image

Attached: 1533509039928.jpg (600x895, 71K)

it doesn't unless you write std::move to make it explicit (which is in effect a cast to Cls&&)

I don't really have many issues with the C string functions. There are a few useless/shit functions, but snprintf replaces most of them.
It'd be nice if a few of those POSIX string functions were made ISO standard, though.

I just tried it though. First main row invokes default constructor, last row invokes copy constructor.

Something something copy elision.

I already know programming and work professionally with it but want to get better and learn Go

Should I get K&R, the Go book by kernighan, SICP or HTDP?

>en.wikipedia.org/wiki/only_respectable_looking_guy_in_the_image
meh doesn't even have a wiki page

>snprintf replaces most of them.
b-b-but that means knowing a length, unless you're just using big scratchpad buffers for string manipulation.

Daily reminder that
auto x = 1;

Is valid C code.

SICP and HTDP: Doesn't really matter. Either is a pretty good read. Read SICP for meme cred.
K&R: Possibly the worst book you could read on modern C. However it looks good in a shelf.

Yes but the difference is that in C is does something completely useless and stupid.

It made sense in B, but no longer serves a purpose in C.

Go for the Go book I guess. Kernighan's books are always great.

>want to get better
Read The Practice of Programming and The Unix Programming Environment.

auto is a modifier. You still need a type if that's supposed to be a declaration.
Of course 'x' could be a macro, among other things.

Only in C89.

snprintf only requires to know the length of the destination buffer. Using it, you can implement asprintf, but it'd be nice if that was just made standard.
The only valid complaint is that it involves parsing a format string, but that is such an insignificant price to pay. snprintf is basically the perfect string function for C.

K&R is comfy. Browsing old Unix sources is comfy. Don't you want to program like the 70s on a loud teletype? Getting a qt to load tapes? Running batch programs overnight?

Attached: 1558947709608.png (240x240, 19K)

void noop(int _) {;}
signal(SIGSEGV, noop);

Attached: IMG_9206.jpg (680x700, 90K)

>comfy
so just boring?

I thought C89 permitted the type specifier to be omitted, defaulting to int, so long as a storage class specifier were provided.

e.g. static x = 0;

>Don't you want to program like the 70s on a loud teletype?
no
>Getting a qt to load tapes?
All I need is my waifu
>Running batch programs overnight?
I run anime tiddie scrapers all day, all night 24/7

>All I need is my waifu
Why not both?

Attached: dec_pdp_11_by_pomorosso_d3fmh8w-pre.jpg (800x1000, 127K)

assigning icons in qt is so fucking slow jesus christ

hopw so

you're a qt

well it's slow, that's about the extent of it

Attached: 1536933848510.jpg (1920x1080, 1.74M)

y-you too user

Oh user, you're the qt here.

Attached: 1558501426940.jpg (2732x3922, 1.05M)

>making gui in cpp
Why

Me on the right
You on the left

let's hope you don't have javascript in mind

That's halt

Who the fuck makes a GUI in cpp?
Use C++ instead.

I wish I were a qt

Only one thing is missing in this image, a comfy blanket to wrap those girls in.

Attached: file.png (952x518, 435K)

you are

which Qt subclass is he?

I tried.

Attached: 1540872513440.jpg (2732x3922, 1.5M)

based user.

QIODevice

Attached: 1556745850898.jpg (407x407, 19K)

sounds impure

Damn right

Attached: 1555989452019.png (1228x1080, 1.71M)

What's better
divide(x, y) {
try (return x / y)
catch (division by zero)
throw (error)
}


Or
divide(x, y) {
if (y = 0)
throw (error)
return (x / y)
}

template
std::optional divide(F x, F y) {
if (y == 0) {
return {};
}

return x / y;
}

Second one, always. If you can prevent a failure before it happening, do that

Fuck, I forgot code tags again
template
std::optional divide(F x, F y) {
if (y == 0) {
return {};
}

return x / y;
}

why not ? :

if (y = 0)
well clearly not this one

You can if you want

Need to learn spotfire and tableau. What advice do you have and what tutorials do you suggest?

>spotfire
what?
>tableau
what?
Fuck off

>haskell software pandoc
>100 packages, 421 MB installed
thanks obama

What's better?

Guard block:
function setRandAttr(Object obj) {

if (obj == null) {
return false;
}

obj.setX(Math.rand());
return true;

}


Or if/else?
function setRandAttr(Object obj) {

if (obj == null) {
return false;
}
else {
obj.setX(Math.rand());
return true;
}

}

I found a job offer (not really coding) that lists basic sql and basic Java skills as requirements. What would you say those are? What specific things can a person having 'basic' sql and java skills do? some basic CRUD app using hibernate would do?