/dpt/ daily programming thread

Old thread

Attached: 1553654396872.png (500x504, 327K)

Other urls found in this thread:

chiark.greenend.org.uk/~sgtatham/coroutines.html
github.com/tuvtran/project-based-learning
en.wikipedia.org/wiki/X86_debug_register
github.com/x64dbg/TitanEngine/blob/7976be4edd84e923f24b8e68fc710262a6f3f4b0/TitanEngine/TitanEngine.Breakpoints.cpp#L174
github.com/x64dbg/T
microsoftpressstore.com/articles/article.aspx?p=2201303
pastebin.com/9bHgA8As
twitter.com/SFWRedditImages

First for C being the GOAT beginner language.

second for JS being the GOAT professional software developer's language

Hey I am a female gamer going into uni, I picked CS cause I have been such a nerd my whole life

If I get into programming specifically are creeps gonna be stalking me everywhere?

Attached: BFB7BAC1-2703-4D5E-B407-C075ACB18B34.png (714x574, 299K)

yeah, use it to your advantage

*haskell
doubt

Attached: DwWog6jV4AAz1Vz.jpg (400x300, 22K)

Please don't sequence/spam post.

Attached: 1438407365550.jpg (165x206, 14K)

sorry user

Attached: memory safety.jpg (700x400, 150K)

yes but atleast they'll do all your assignments for you fo free

wrong

I really really like this image

no but you will have a lot of academic and laboral opportunities because of muh female representation. also you can have dick whenever you want

the absolute state

Attached: file.png (165x38, 754)

bobs or gtfo

>Haskell

Have fun living in a bubble of self-congratulatory, fart sniffing conjecture with zero real world application.

>seething OOPsie

Attached: 1548277977844.png (780x1000, 557K)

why do haskelleers think everyone who doesn't like their language likes OOP

experience

post tricks

char array[20][20] = {
#include "map.h"
}

unsafePerformIO $ useful haskell code

Hello.
I need a GUI toolkit to make an application with windows, buttons and especially (axis) charts in C.
What is the best GUI librairy to make this ?

compile time counters in c++
template
struct flag {
friend constexpr int adl_flag (flag);
};

template
struct writer {
friend constexpr int adl_flag (flag) {
return N;
}

static constexpr int value = N;
};

template
int constexpr reader (int, flag) {
return N;
}

template
int constexpr reader (float, flag, int R = reader (0, flag {})) {
return R;
}

int constexpr reader (float, flag) {
return 0;
}

template
int constexpr next (int R = writer::value) {
return R;
}


stackless coroutines in C
int function(void) {
static int i, state = 0;
switch (state) {
case 0: /* start of function */
for (i = 0; i < 10; i++) {
state = 1; /* so we will come back to "case 1" */
return i;
case 1:; /* resume control straight after the return */
}
}
}
chiark.greenend.org.uk/~sgtatham/coroutines.html

I'm learning C++ right now and am on polymorphism
I know you can't call a member function that was declared in the derived class, but what if it was overloaded from the base class? would it just call the base class function?

nevermind, just read the virtual members section

Harvesting (You)'s has never been so easy

Attached: A640D265-370D-46A0-8FE1-615DFF384856.jpg (420x420, 32K)

-[------->+.-[->++++.++[--->++.+++.+++++++.+[->+++.--[--->+-.--[->+++++.----------.++++++.-[---->++++.[-->+++-.[--->+-.++++++++++++.++++.[++>---+.

why do people use brainfuck unironically?
akarin is cute, have another one

Attached: 1474581068383.jpg (867x1300, 418K)

I'm not sure where to go next with my programming education so I'm just gonna read SICP like a grown ass man, I guess.

I just want to start doing some sick projects, but everything I imagine is either way over my head or far too tedious.

Attached: 400px-Pacifictreefrog2kjfmartin.jpg (400x267, 23K)

I hope you realize that SICP is just a meme that Jow Forums throws around to trick newfags. It's honestly useless.

I love you /dpt/
-[------->+.-[->++++.++[--->++.+++.+++++++.+[->+++.--[--->+-.--[->+++++.----------.++++++.-[---->++++.[-->+++-.[--->+-.++++++++++++.++++.[++>---+.
Yeah, brainfuck is gay

>sick projects
by this I mostly have three in mind: a minecraft clone with my own spin on it (quest and some other crap, maybe like space travel possibilities), building an FPGA and an OS, and doing some cool stuff with machine learning, an audio sample database and additive synthesis. I don't know how to get to these goals quickly or efficiently though.

I've never really done a large project though, with multiple files and everything, so I guess I'm just looking for a path, or resource, or advice from some asshole here.

Attached: 1448302183029.jpg (1280x720, 71K)

use an ide
while you will not use 99% of its features, the project management tools are absolutely necessary

I would also like to get to the point where I can read and understand open source projects to both modify them on my own and make meaningful contributions.

help me /dpt/, I'm getting really sad. I enjoy programming but don't know where to go. all the books feel dry and I have no side projects other than some web data crap, but that quickly became more about web scraping and XML parsing and using Python libraries than it was about programming.

I use emacs, it's probably good enough for that task. I am looking more for advice on where to go in my education and projects.. I can put my nose back on the grindstone, but I feel there's a smarter way than what I've been doing.

Also, where to go after SICP? I've dabbled in a lot of different shit but I really want to pragmatically power level, so I think I'm going to go into C and computer architecture.

Attached: girl.jpg (1284x1949, 339K)

learn c++
all of it
all the bloat

everything from template metaprogramming to lockfree programming
if you can do that you can understand anything
that's the thing the cniles don't get
the process of learning c++ is actually the programming equivalent of enlightenment
it changes you for the better

experiment with mutliple complex third party libs
embed and extend a scripting language like lua
make some gui tools in QT
write a physically based renderer using opengl
write it again using vulkan
rewrite your qt based tools using something like imgui or nuklear

look into various file format standards
try your hand at reverse engineering some shit

Are there any good resources on making a fast interpreter? I can’t find any because everyone just makes compilers or JITs for performance.

Attached: EBCB4754-F773-4194-B703-4C175B152431.jpg (1280x720, 94K)

I actually started with C++, but that was just an "intro programming" class. I do like C++ too. I think the essence of what you're saying is just to fucking write, and that's good advice.

I just want to get a big daddy project under my belt, something that actually forces me to use version control, I found a good list of projects here:
>github.com/tuvtran/project-based-learning

I'll probably start one of the lower hanging fruits today.

reverse engineering is the best shit ever

oof, some of that stuff is seriously not easy

>I think the essence of what you're saying is just to fucking write
not just write, write practically, but yes

Attached: 98DA05C9-2BF1-40F2-B40D-7D14037AD5BF.jpg (1280x1264, 103K)

dont you need to know C and assembly to get into reverse engineering?

the process of learning c++ includes learning c and assembly
do not underestimate the bloat

if you know c++ you know c

have you guys used CRT monitors before? how was it compared to LCD? I'm thinking about buying a small one for the retro aesthetic, I would mostly use it for task that don't even require X windows, so I assume it'll be fine

btw, I mean more for like staring at for hours on end, will it fatigue my eyes more?

>being a zoomer

>have you guys used CRT monitors before
Goddamn newfags. It's just a normal monitor, just heavy as fuck. I changed my 1024x768 CRT to 1280x1024 LCD in 2007 and never looked back

>have you guys used CRT monitors before?
how old are you?

the c++ programming language or
c++ primer

Miia is best waifu.

I am thinking about writing my own Windows debugger. I understand the basics, attach, write the debugging loop and you basically have a listener/callback.
But how do I do things like setting breakpoints? I guess it's possible with writeremotememory, but that can't be the best way to do this.

Programming: Principles and Practice Using C++

windows has syscalls for setting breakpoints, so whatever their abstracted form in the windows dbghelp api is

wait i checked msdn it might not be dbghelp
where the fuck did i see that

en.wikipedia.org/wiki/X86_debug_register

I've read the documentation and all I have seen so far is DebugBreak(), but that has to be inside the debugged code and is done at compile time.
Can't seem to find anything relevant on Google.

where that battleship user go?
and where is his email?

>tfw your toy language’s macros are so powerful it already has structs

Attached: 363A777E-AFCD-41BF-A245-0A396F9AC66F.png (352x352, 250K)

Attached: 1530055894397.png (762x464, 31K)

This is how TitanEngine does it

github.com/x64dbg/TitanEngine/blob/7976be4edd84e923f24b8e68fc710262a6f3f4b0/TitanEngine/TitanEngine.Breakpoints.cpp#L174

>github.com/x64dbg/T
thx will check it out

23, i’ve used crts before but i didn’t stare at screens all day like i do now. i am looking to buy it mostly for a dedicated recreational programming machine, would be cool to graph some sound waves on a crt

it’s not a normal monitor, the technology behind it is analog, not digital, and it literally shoots x rays at your eyeball, unlike an lcd, hence the concern

take the boomer goggles off and bow down to your zoomer overlord

A study has shown that the CRT radiation itself has an addictive effect, independent of what is shown on the screen.
>not injecting electronic heroin into your eyes

Now you can hide the content and show a label when the user is editing their interface :^)

Attached: contenthidinglabels.gif (722x379, 136K)

What UI library/framework are you using?

Anyone familiar with Agner Fog's vector library?

// function rotate_left all elements
// Use negative count to rotate right

static inline Vec8i rotate_left(Vec8i const & a, int b) {
#ifdef __AVX512VL__
return _mm256_rolv_epi32(a, _mm256_set1_epi32(b));
#else
__m256i left = _mm256_sll_epi32(a,_mm_cvtsi32_si128(b & 0x1F)); // a > (32 - b)
__m256i rot = _mm256_or_si256(left,right); // or
return rot;
#endif
}

Two questions:
1) Why does he use sll and not slli, when he's working with an integer shift amount? The throughput is the same, so it should just be an unneeded _mm_cvtsi32_si128.
2) Why doesn't he split it up into separate functions to avoid the masking? It's named rotate_left, not rotate, so shouldn't the prudent thing be to have three different functions?
>one with the masking, all inputs OK
>one that only goes left, negative shift UB, zero shift UB
>one that only goes right, negative shift UB, zero shift UB
3) Why does he subtract 32 if he's taking it modulo 32 anyway? Why not just -b & 0x1F?

microsoftpressstore.com/articles/article.aspx?p=2201303

See at 'Setting Code Breakpoints'

thx again

[email protected]

sorry had to leave to go to a class.

sounds comfy, thanks user. any other tips? The model I’m looking at picking up today is an Epson MCM 4035N E

it’s cute, but the resolution is low (640x200) - should i avoid such a painfully low resolution? i was hoping for at least 640x480..

>the technology behind it is analog, not digital
No shit. By "normal" I mean "it looks normal". It's not a crappy-ass TV, the resolution (even 800x600) is higher so you won't see the grille or scanlines or phosphor or whatever.

way to gloss over the actual point of x rays being shot into my retinas

If you were to design a class for students that have never seen programming before what lang would you use? C, C++, Java, or Python?

>implying CRTs emit xrays
why are my radiographs so expensive

java or C. C++ is too much for them. Python would make it too easy for them and they'd have a harder time transitioning to other langs.

I would honestly recommend spreadsheets for people with no previous exposure.

This, then C++ Primer 5th Edition

Python. Or maybe even some toy language. But Python should be fine. I think it's important to use words they will understand, use some metaphors and motivate the course. In other words, what can they do that will help them?

Python, it’s easy to pick up and learning a new language is trivial when you already know the basics.

C.

why bother with cpp primer after that

isn't it a brief book? or am I thinking of The C Programming Language.

>1300 pages
yeah i'm an idiot, i thought it only about 400 pages or so.

1)No idea, actuslly. sll and sllli are even the same instruction (vpslld).
2)Maybe he was lazy
3)A few positve and negative values I tested in my head all lead to the same results, so I dunno. It's 1AM here and I might be wrong, though.

I'm someone that has never done programming before learning Java - it seems to be pretty easy so far (2 weeks in), and actually not as esoteric as I was expecting programming to be after not coming from a programming/tech background whatsoever, currently 2 weeks in. My only worry at the moment is Java becoming obsolete but I think that might be the case if you're studying any language outside of C/C++/Python (R if doing stats).

I figured out the answer to number 1. In GCC at -O2 and higher, slli gets compiled into vmovq (64-bit), while sll gets compiled into vmovd (32-bit). And n2 is the prudent choice.

The subtraction gets optimized out in GCC, so that's a giant mystery.

rate my code
[spoiler]no bully[/spoiler]
pastebin.com/9bHgA8As


][/code]

How did i manage to fuck up this bad

>pastebin.com/9bHgA8As
>reddit spacing

what the fuck am I even reading here

Makes sense. You still have to put b into ymm register, so there's implicit cvtsi32_si128 anyway.

its for easier understanding

why

are you

putting so many


newline

Wait a second. The answer is actually simpler: slli requires an immediate value, it can't be variable.

too


much


white


space