/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Last thread:

Attached: 1492931341278.png (1920x1080, 1.63M)

Other urls found in this thread:

github.com/enfiskutensykkel/ssd-gpu-dma
github.com/freebsd/freebsd/tree/master/lib/libusbhid
fgiesen.wordpress.com/2010/12/14/ring-buffers-and-queues/
github.com/npryce/maybe-java
twitter.com/SFWRedditImages

Trust is the most powerful programming Rust.

Ocaml is ok.

int main (int argc, char* argv[argc+1])

what did Gustedt mean by this?

Been working on a new aimbot and some Wallhack type hacks for Halo, might code in some pathfinding and make it a full bot

What's the point? It's not like C has bound checks or iterators.

I'm restructuring my NVMe library in order to make the different code paths more modular, and borrowing some concepts from the Linux kernel (using kernel-style OOP with "ops" function pointers).

I'm also fixing some bugs I had with cache coherency, as well as making minor improvements here and there (for example improving the ring buffer/queue implementation with a bit to indicate whether a queue is full or empty).

github.com/enfiskutensykkel/ssd-gpu-dma

That's not valid C afaik, if supplying a size argument, it must be determined at compile time.

He's a Jehovah's witness and his parents are unironic flat earthers who believe the Moon was built by time travellers, he's no stranger to the bizzare.

>he doesn't know about
int main(int argc, char *argv[], char *envp[])

Who is Gustedt?

trying to build liquidfun but it gives me the error

usbhid.h: No such file or directory
#include

anyone an idea to what is missing? Im only get some arduino shit when googling

Which programming-related field has the best work/life balance and pay? I imagine it’s not webdev or game dev, but idk what it is. What is the path that is least likely to make me end up with a dead-end job that I loathe?

sudo apt-get install libusbhid-dev

I tried that but
Unable to locate package libusbhid-dev

Im using mint.

> the best work/life balance and pay
Being a Haskell programmer, which means no work and all life - the best work/life balance possible.

>I imagine it’s not webdev
I had a pretty comfy life as a webdev, pay was good and work/life balance was really good (I managed to do a master's on the side). Embedded is hell, it's terribly paid and unpaid overtime is pretty much norm unless you have kids.

download and compile from source

github.com/freebsd/freebsd/tree/master/lib/libusbhid

after that change #include to #include "usbhid.h"

How2get a remote job? Like an actual one, not freelancing for minimum wage. They do exist, ri-right?

"Modern C" guy, ISO committee member for the C language who co-edits the standard.

>That's not valid C afaik
Is it valid C17? It's what the guy who edited the standard advocates.

I see, thanks.

why doesn't this work btw it's JS
"use strict";
var recordSet = [0,1,2,3,4,5,6,7,8,9];
var target = 7;
var l = 0;
var r = recordSet - 1;
var middle = Math.floor((l + r) / 2);
while(l target) {
r = middle - 1;
console.log(false);
}
else {
console.log(middle);
}
}

I didn't realise it was a standard proposal because I didn't know who he is. The other user was so nice to clear that up for me.

>recordSet - 1
Did you mean recordSet.length here?

because r is NaN

Absoluely disgusting.

In my opinion the nicest ring buffer implementation is just pretending it's a contiguous infinite stream of data. No additional flags necessary. See fgiesen.wordpress.com/2010/12/14/ring-buffers-and-queues/
You have to account for uint wraparound, but that's just a subtraction and a cast.

Always an option.

What kind of webdev did you do? Front end? Also, I’m curious about what you think of freelancing vs being employed at an established company.

I like Lisp.

Attached: 1490725411831.jpg (358x599, 103K)

It's ok, grandpa, the nurse will change your diaper soon.

>teehee it's dead
how about you kys

>What kind of webdev did you do?
Backend REST API for a web application that did light image and video processing as well as elastic search in metadata. Mostly Python and some C++.

>I’m curious about what you think of freelancing vs being employed at an established company.
I could personally never do freelance, because of the job insecurity as well as needing to do pension saving, taxes, saving up for sick days and all admin stuff myself.

>In my opinion the nicest ring buffer implementation is just pretending it's a contiguous infinite stream of data. No additional flags necessary.

fgiesen.wordpress.com/2010/12/14/ring-buffers-and-queues/
>When adding elements to the queue, block when it contains SIZE - 1 elements. What you definitely shouldn’t do is get fancy and use special encodings for an empty (or full) queue and riddle the code with ifs. I’ve seen this a couple times, and it’s bad. It makes “lock-free” implementations hard, and when dealing with hardware, you usually have no locks. If you use this method, just live with the very slight memory waste.
This is literally the solution I already do, but it is wasteful as I lose an element in the queue which affects performance. I don't need to deal with synchronicity, each thread should have their own queue.

give me something to do

Attached: Ai_Hinatsuru_GIF1.gif (600x338, 1.45M)

java would be great if everyone stopped using all the shitty standards like JPA, "Beans", JAXRS and god knows what else

too late just use portable C

Do my job for me, while I shitpost here.

Should I still read SICP if I hate Jews?

What does envp represent?

No relevant project out there uses portable C.

Environment variables.

how do you start contributing to a project? I have 2 projects i'd like to help with but the codebase is moderately big and i feel like i'd be a nuisance constantly asking what parts of the code do.
do you need to "catch" the project in it's early stages to be able to more easily contribute?

You shouldn't read SICP even if you love Jews. The only reason to read SICP is being a CS freshman at MIT in 1986.

>No relevant project
sasuga user for preemptively shifting the goal posts
>provide a excellent portable C project
>"uh no thats not relevant"

> do you need to "catch" the project in it's early stages to be able to more easily contribute?
Definitely not, just spend some time reading code familiarizing yourself with the architecture, then look for a simple issue and try to fix it, then make a PR. Big projects usually have CONTRIBUTING.md or something like that.

Write a (basic) raytracer or software rasterizer.
The theory is simple but teaches you about the fundamentals of graphics, you have something cool you can show to others and it's fun.

Which language is most valuable and most likely to give the highest pay? I’m ignoring specialisation in this question. I’m wondering mastery of which language is in itself most valuable. Most meme charts say Python or Ruby, but I don’t buy it. I imagine it’s C++ or Java

Absolutely disgusting.
int main(int argc, char **argv)

you have convinced me user-san, i will take on this task you have entrusted me

Attached: 391.png (1280x720, 1016K)

i'd say java or c# for sure
if you know a bit of webshit and how to make basic CRUD apps ryou are set for the next 15 years at minimum

How about you actually provide it instead of trying to predict supposed goalpost shifting?

>implying your not going to shift the goal posts

Really, it shouldn't be that hard. Provide a somewhat relevant piece of software written in 100% standards-compliant C.
Being standards-compliant is an objective truth: either the project is, or it isn't. I don't see why you are so worried about potential goalpost moving.

>tfw love coding
>but if i do CS i will be just a codemonkey
Had to go with computer networking feels bad man

Working on making some tasks work across a variety of target platforms. Trying to implement a read of the hardware registers, but having a brain fart on how to structure this.

I need to read a register with an offset (fine), convert the number into an integer (I have a function) and store it in a comma separated string. This bit is my struggle.

Element 0 and 1 will be the first digit, element 2 will be a comma, element 3 and 4 will be second digit, element 5 will be the comma, element 6, 7 is third digit, 8th element comma etc.

How can I do that in a for loop?!

> 100% standards-compliant C
No such thing, a C programmer can't write 100 lines without introducing a UB.

Dumb question:
In Go, why can't you compare a struct instance to nil? Why do you have to use a pointer to compare to nil?
Is this the same in C++?

What is the nil value of a struct?

C++ does not have nil. C++ has nullptr. This should explain it.

Because it's a value type, that'd be like comparing an int to nil

Okay thanks.

Who would use python?
Seriously, its slower than c++, its a fucking annoying language with faggotrys.
ITS A BAD!!! LANGUAGE

>it is wasteful as I lose an element in the queue which affects performance
The second method described actually doesn't waste an element.

Yeah, I saw that after reading a bit further. I'm currently implementing that now, thanks user.

posts like this is why open source is a mistake

is c++ const / java final autism really worth it?
i feel like those kind of bugs are really rare

It is if you want to read your code in a month

Please remember that regular workout WILL make you a better programmer.

Attached: idea.jpg (743x635, 48K)

I don't know what to make

why?

>is c++ const / java final autism really worth it?
Yes

>i feel like those kind of bugs are really rare
At least for C and C++, it greatly increases the readability of your code.

people with no experience who would be more of a hinderance than a help trying to "contibute" because it's cool

did anyone got an actual use for final parameters in Java?

Open source is usually merit based, and have meticulous style and readability requirements which filters out retards.

not him but
>because it's cool
say that's not the reason, then how do you start?

Not the guy you're replying to, but usually it's because it's something you need and use that's imperfect.

Should i mention my discord bot (written in js) on my resume when applying for a job? I'd link my git hub, which has it, either way.
It's a pretty neat project, but not really all that complicated. Would it be taken seriously at all? I don't want to purely mention my completed websites on it, needs some diversity and something written purely with javascript i feel.

>it greatly increases the readability of your code.
not when you start putting before function name, in it, after it, after its arguments, after if, after for, before variable decl, after variable decl, before initializer list, in initialzer list, before, in, after templates......

**argv
You should die horribly.

Any feature can be misused and overengineered.

boolean myBool = myString.replaceFirst("-.").matches("0-9+")
Is this a genius way to check if a string can be parsed to a double or what?

dont start
make your own shit instead

Do you use design patterns?
If so which ones?

Why? It's the sanest, tersest and most explicit.

everything should be const by default.
Programming is literally applying algorithms and giving meaning to data structures. only took me so long to figure it out..
Someone please suggest me a proper programming language that recognizes and further enables that.

you forgot the e notation and things like INF and NAN

github.com/npryce/maybe-java

if everything is const you dont have much of a program

Because you should use proper placement for asterisk(s) since they are part of the type.
char** argv

>everything should be const by default.
Ideally, yes. But that would break existing C and sepples.

>Someone please suggest me a proper programming language that recognizes and further enables that.
Python

what does experience have anything to do with my question?

and also how exactly would someone gain experience without doing it? if that's your mentally then reflect on why you're still virgin

Haskell

They are not part of the type specifier, though. They're part of the declarator.

Could you please demonstrate how to declare a function pointer?

because if you were experienced you wouldn't be asking it
gain experience working on your own projects don't correct typos on open source shit for good boy points

Just done free python "course" and gonna try to make a game. By that i mean display a tilemap and something i can move left and right. Later I'll make it jump. By "make" i mean google, analyze and replicate.

Rust

Haskell, unironically.

Wrong. The only thing unknown is external input so when it is processed (if possible) it will be put into its proper structure/place then everything can be practically unchanging and flowing through a pre-determined set of actions that produce results that are further processed until a final result is reached.

>They are not part of the type specifier, though
Oh yes they are:
sizeof(argv) != sizeof(**argv)


>function pointer
int(*)(int, int)
What about it?

most programs dont take an input and produce an output, they run continuously

>I don't understand what a type specifier is
>I don't know what a declaration is.
Please leave until you are properly educated, you're embarrassing yourself.

How can I create immutable variables in Python?