/dpt/ - Daily Programming Thread

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

Attached: 1543208711905.png (842x462, 257K)

Other urls found in this thread:

github.com/lattera/glibc/blob/master/string/memcpy.c
en.m.wikipedia.org/wiki/Dereference_operator
twitter.com/SFWRedditGifs

C++

JavaScript rocks!

Attached: javascript rocks.png (1000x494, 134K)

>eternal hidamari sketch /dpt/
i'm ok with this

Attached: 1545171644466.jpg (800x450, 181K)

i swear you must be making the most dumb-fuck looking code to be getting compilers to generate stuff that looks like that

Lisp is the most powerful programming language.

I chose performance over readability. That's why it's unrolled, not in a for loop. A for loop would produce slower Assembly, dumbass.

Is hidamari a tranny?

I like C#.

Attached: 1543548155827.jpg (1910x2643, 303K)

Does that assembly even work, since adding to a pointer would require another operation since you don't know it at runtime? (malloc)

are you hand-assembling this like a dumb shit or something?
just use fucking simd already to batch-copy.
in fact just call memcpy at that point because it already has all those optimizations done for you
github.com/lattera/glibc/blob/master/string/memcpy.c
your assembly is looking as bad as brainlet code

Attached: r_102813_Wx1Vb.jpg (500x483, 28K)

found the canadian aboriginal

>Does that assembly even work
Idk, ask gcc. It's the thing that made it.

>is a manga/anime series a tranny?
I'm going to guess no.

Attached: 1547494151239.gif (500x720, 2.39M)

Can I do that with longs? I would think gcc would simd if possible.

xml lexer

Attached: 1548019684788.png (600x600, 712K)

You know, you can make your compiler unroll loops for you, right?

What does Jow Forums think of MicroPython? Supposedly it's Python for microcontrollers but an interpreted language running inside a MCU doesn't seem like a very good idea to me

best place to buy programmer socks?

memcpy is just copying bytes with whatever acceleration is possible and available with your current architecture, from virtual page trickery to cache line flushing to batch simd copies. it doesnt matter what it is. It will move its data. Bytes are bytes

Also, forgot the pic

Attached: this runs python.jpg (600x600, 226K)

That's what it's doing, dumbass.

Amazon.

Getting through a CMU Python course so I can finish a web scraping and analysis project at a reasonable pace.

But would it do that if called from an Assembly file? That sounds like an optimization worth having but if it only works with C I would have to change my compiler to use C as the target language instead of Assembly.

I want something fun and low level to write demoscene bullshit in. Ideas?

Still working on reverse engineering a proprietary and undocumented file format.

What for?

you can call C code from assembly, call conventions are standard (cdecl)
you're already calling malloc, a C function

do tell

got a git? how are you handling notes? are you making a library?

but why?

No, but they are all gay. Platonically. You could even say they are all good friends.

C question:

why do pointers to pointers have a double asterix?

dont they hold the same thing?(an address value)

god i fucking hate reading the dumb shit beginners ask

>you can call C code from assembly, call conventions are standard (cdecl)
>you're already calling malloc, a C function
I know. My question is will it still optimize?

It's to do with the type system, not how they're actually represented in memory.

>No, but they are all gay. Platonically. You could even say they are all good friends.
Oh. Thats a new one.

I see, thanks.

yes

Okay good.

>why do pointers to pointers have a double asterix?
they don't

but this means six
(* (* 1 2) 3)

The basic idea is that if you dereference a pointer, you'll get some data of a certain type. e.g. If you dereference int*, you get an int value.
Now, if you didn't have types for pointers to pointers and pointers to primitive values like ints, you couldn't be sure whether int* dereferenced is actually a pointer to a value or just another pointer.
Because we do have that differentiation we know though that if we if we dereference int** we get an int pointer and if we dereference it again, we'll get an int pointer.

>C question:

C question: What is the best underlying type to use to partition a bitfield struct?

>woosh
>he also doesn't use polish notation macros

The smallest type that fits, also probably an unsigned one.

Is C++ memory safe if I just use the STL and not pointers at all?

>>woosh
die

That doesn't work in practice.

just dont code like a dumb ass

use unique_ptr and quiet letting scared webdevs spout how "unsafe" C++ and C are just because they miss their JIT and VM and garbage collection

>>woosh
Why do GNU-males use this term?
>>he also doesn't use polish notation macros
1) Making them macros instead of functions defeats the purpose of using the polish notation in the first place.
2) C's lack of proper first-class functions also defeats the purpose of using polish notation.
3) How the fuck do you define a macro whose name consists of punctuation.
4) You should avoid using C macros except where necessary. C's macro system is unsanitized, lacks recursion (another point that defeats the purpose of using polish notation), and isn't even Turing complete on its own.

also remove [] from your keyboard

C++ is memory safe even with pointers, as long as you free everything you allocate.

>Why do GNU-males use this term?
why can't autists parse humor?

You deserve to be burned alive and buried in a landfill with rest of the garbage, you subhuman shit stain.

It's a stupidly irresponsible project
Python uses a wider diameter pointer data kind that doesn't exist on smaller devices so it uses up all its core memory trying to translate CPU words

>and isn't even Turing complete on its own
You say that like it's a bad thing.
I don't want my programs to be literally undecidable to parse and compile.

>also remove [] from your keyboard
Then you wouldn't be able to use C++ at all.

Attached: Untitled.png (692x474, 98K)

>durr it was just ironic humor gaiz

Attached: 58417479bff01bc1f65f210f8cfb3dc533d4ffbd6cd50d51568159bc7f9eb198.png (1280x720, 484K)

Better possibly undecidable to parse and compile than guaranteed decidable at the cost of possible compile-time optimizations.

>humor?
Why do GNU-males think """"""""woosh"""""""""" is humor?

Attached: Although+i+agree+that+taking+pride+in+or+being+ashamed+_50ca68dc0391d417436768df8b4bb56d.png (600x601, 104K)

Why?

makes totally sense now. thanks for the explanation

Because in practice, you use other people's libraries and frameworks, and many libraries and frameworks use pointers as part of their public interface.

>/dpt/
where you funnily explain ** is two applications of an operator which means you're a numale that deserves to be buried alive

that's it, i'm going back to hackernews

pls respond

Attached: out.webm (1130x736, 2.32M)

anyone have a javascript pdf

Attached: 1544126787326.jpg (680x680, 49K)

>where you funnily explain ** is two applications of an operator
It's not though. We're talking about C here.
>which means you're a numale
GNU-male *
>that deserves to be buried alive
literally no one said this, fuck off back out of the ground, you've got more life left to live. always remember what yosho says: do NOT suicide, you will DIE.

please tell more desu

the pic related made me cry

looks smooth

>>where you funnily explain ** is two applications of an operator
>It's not though. We're talking about C here.
yet you've never used it lol

thanks it uses vulkan
and it's all raymarching too. None of that RTX stuff. So it'll even run very fast on an integrated GPU.

Attached: 2019-01-20_16-29-51.gif (584x378, 2.43M)

what the fuck version of C are you talking about?
are you fucking drunk?
because it sure sounds to me like you're confusing C with Scheme.

for reference, here is a trivial example of how ** is used in C:

#include
int main() {
int x;
int *xp = &x;
int **xpp = &xp;
**xpp = 6;
printf("%d\n", x); // => 6
return 0;
}


if you don't recognize the above programming language, you don't know what the fuck you're talking about.

use webm so it doesn't get compressed to shit

negro thats the de reference operator

For some type T, a pointer to T is called T*. If T is char*, what should we call a pointer to char*? Following the same consistent format, it's char**.

okay
thanks user

so tl:dr: its for consistency, i.e, de referencing it will yeild a int* which in turn yeilds an int

anime causes transgenderism
i know from personal experience

>**xpp = 6;
so like I said: 2 applications of an operator and autists can't parse humor

holy fuck it's flooded in here

listen aspies: pointers don't HAVE an operator, it's USED on them, just like numbers, e.g. ** 1 2 3 in polish notation

fuck you're all retarded

Sock Dreams is the best place
amazon has a lot of cheap chinese socks which will not be nearly as well-made

That would be like using an FFI library from someone. I tried making a GUI in Haskell using the Win32 package and I had to deal with pointers.

many things can cause transgenderism, for me it was my dad's privates lol

It's not the anime, you were always a faggot.

lmao, you're literally a fagggot

en.m.wikipedia.org/wiki/Dereference_operator

Attached: 1547980005550.png (645x729, 105K)

was not expecting a serious answer lol
ill be coming back again for more tips on programmer fashion

everyone listen to this user

>so like I said: 2 applications of an operator and autists can't parse humor
Yeah but it's not the operator you were talking about. You were talking about the binary * in polish notation, which is incorrect because C doesn't have polish notation operators.
>listen aspies: pointers don't HAVE an operator, it's USED on them, just like numbers, e.g. ** 1 2 3 in polish notation
This is also wrong. ** isn't always two applications of an operator even when it's the dereference operator we're talking about. Operators are language constructs with value operands and runtime results. Sometimes, specifically in pointer declarations, unary * is not an operator by this definition, seeing as it's instead a language construct that has a type operand and a compile-time result.

no u

why do I come here lol

C++ did not invent the word "operator" when they created operator overloading, user

* and + and % and && and ^ and , and ++ were always called operators in C.

k

Attached: 135.png (680x680, 124K)

You literally just said you know from experience that anime causes transgenderism.
And now you're calling *me* a faggot?
Please. I mean you're not wrong, but at least I had my degeneracy forced on me. You on the other hand literally just admitted to willfully subjecting yourself to it.

thats not compression actually that's the adaptive resolution(can be disabled).
It dynamically adjusts the buffer resolution when being interacted with by the user so that it gets stupidly cheap to render a frame while the user is tweaking with things. Starting from the lowest res and ramping up to the higher resolution

Attached: out.webm (1062x540, 1.11M)

This operator argument is hands down the dumbest argument I've seen on here, and I've seen quite a lot.

>C++ did not invent the word "operator" when they created operator overloading, user
Literally nothing to do with anything I said.
>* and + and % and && and ^ and , and ++ were always called operators in C.
That's true, but unary * is not an operator when it's used in a declaration. That was never what an operator is, C++ be damned. In the context of "int *xp = &x;", * is not an operator any more than { and ; are operators.

why indeed

>but unary * is not an operator when it's used in a declaration
yet it operates on its arguments to change its type checkmate atheists

Attached: triggered.jpg (500x685, 276K)