/dpt/ - Daily Programming Thread

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

Attached: K&R himegoto waifux2.png (1000x1400, 1.31M)

Other urls found in this thread:

youtube.com/watch?v=6pYvGuWZHp0
kevv.net/you-probably-dont-need-recaptcha/
news.ycombinator.com/item?id=20158386
phpcaptcha.org/)
twitter.com/SFWRedditGifs

I'm working on quitting my addiction to talking with trolls on /dpt/.

Attached: turtle, cute.png (700x528, 677K)

i suggest you delete this thread and make a new one with a different image

Attached: 1559494305630m.jpg (1024x777, 72K)

Why, I like it. It's cute and it has K&R, which is a great book.

That image has been used as a /dpt/ for years, it's better than some random image pulled off the front page of /c/.

Why use size_t instead of an unsigned int? Is it just because size_t is a guaranteed bitwidth?

Attached: 1558102794480.png (240x240, 107K)

Portability. Maybe unsigned is 32 bits on your platform but an array can be 6GB long.

how about an image of the fox holding k&r

no, try an anime fox.

Attached: 1559071009533.png (443x739, 751K)

Well, mainly because size_t is an unsigned long for at least 64-bit compilers.

By definition, size_t is used to represent the size of an object. By implication, it's guaranteed to hold any array index.

You've been getting better at JavaScript. Good job, user.

Attached: 4ddf1eba868153f896467babcdd3a467.jpg (768x1152, 59K)

I keep seeing people use it for trivial for loops in test suites when the number of test cases is only a few hundred elements long. I can appreciate it in a database program perhaps but it just makes me mad seeing it otherwise.

It's good enough.

Attached: good enough.jpg (400x400, 4K)

I think it's descriptive. If it's in use, it's describing something that represents an object's size.

Usually at work I always focus on work.
Today I opened terminal and just chatted whole day in IRC.
Feels bad but then again I have no idea how much others waste time while working.

I saw this in some code.
Why does this work?
Also if I remove const from line number 10 i.e
const unsigned int Test::mId{99};

compiler gives error saying re-definition.

Full code
#include
template
class Test
{
public:
static const unsigned int mId;
};

template
const unsigned int Test::mId{99};

int main()
{
std::cout

size_t length;

Attached: 1560098220010.jpg (1440x1080, 117K)

Why shouldn't it work?

>What are you working on, Jow Forums?
Starting work on a config file parser. It is comfy.

#include
#include
#include "config.h"

#define CONFIG_LINE_MAX_LEN 256

void parse_line(char *line)
{

}

int parse_config(char *filename)
{
char line[CONFIG_LINE_MAX_LEN] = { 0 }; // Hold this, stack!
FILE *f = fopen(filename, "r");
if (f == NULL || feof(f)) {
fprintf(stderr, "[-] Failed to open config file\n");
return -1;
}

char *p = fgets(line, CONFIG_LINE_MAX_LEN, f);
while (p != NULL) {
parse_line(line);
p = fgets(line, CONFIG_LINE_MAX_LEN, f);
}

fclose(f);
}

Much better

typedef uint unsigned int;
#define size_t uint

That's how you initialize static variables in sepples.

Where to read how the memory is being handled in the OS? What are the schedulers, virtual/physical memory, paging? I don't fully understand what does "Segmentation fault" means. What if I must allocate the memory within a certain block, like 0xBBBB - 0xFFFF? Are there any books?
In C++17 you can forcibly declare a static variable as inline and initialize it by value inside the class.

No, what you lose is do-notation, which makes bind chaining readable, and the ability to specify a monad interface.

alright WTF

I am trying to understand how to use openssl RSA functions
an user previously told me to use RSA_generate_key_ex
I went to github and followed the tree of functions triggered by it
and they lead nowhere!

it goes like this
RSA_generate_key_ex (triggers) rsa_keygen
rsa_keygen = function pointer set by RSA_meth_set_keygen
RSA_meth_set_keygen is used nowhere

whats going on here?

size_t should be used for dealing with sizes on LOCAL objects, but it gets confusing when you have a networked application and one side uses 64-bit wide size_t's (x86-64) and the other 32-bit (ARM 32). uint64_t is better in this case.

can you make do-notation interoperate with folks' existing .net code?

I am implementing ECS for my game engine. Fucking I hate working 10 hours for day job and then spend only 2-3 hours for my work.
How do you guys deal with this?

should be pretty easy to integrate it with linq

>parse_line empty

quit your job
also ECS is a meme, dont fall for it

this is why hobby projects need profit potential

You simply deal with it and treat as your secondary goal. If your survival matters on the job, then there's not much you can do with it.

What? I don't understand what you're trying to say.
do-notation is literally just syntactic sugar. If you have a monad interface/type class and lambda functions it's trivial to implement and would work just like bind chaining would right now. There's absolutely nothing that could break interoperability.
As a non-game developer, what's the issue with ECS?

I said I am starting work. Here is what I have.

#include
#include
#include "config.h"

#define CONFIG_LINE_MAX_LEN 256

void parse_line(char *line)
{
char tmp[CONFIG_LINE_MAX_LEN];
char *p = strstr(line, "=");
if (p == NULL) {
fprintf(stderr, "[-] Failed to parse config line.\n");
fprintf(stderr, "[-] Config line: %s\n", line);
}
size_t key_len = line-p;
int num_read = sscanf(p, " %.*s ", key_len, tmp);
if (num_read == 0) {
fprintf(stderr, "[-] Error reading line key\n")
fprintf(stderr, "[-] Config line: %s\n", line);
}
}

int parse_config(char *filename)
{
char line[CONFIG_LINE_MAX_LEN] = { 0 }; // Hold this, stack!
FILE *f = fopen(filename, "r");
if (f == NULL || feof(f)) {
fprintf(stderr, "[-] Failed to open config file\n");
return -1;
}

char *p = fgets(line, CONFIG_LINE_MAX_LEN, f);
while (p != NULL) {
parse_line(line);
p = fgets(line, CONFIG_LINE_MAX_LEN, f);
}

fclose(f);
return 0;
}

Attached: 400px-Compose_key_on_Sun_Type_5c_keyboard.jpg (400x252, 24K)

>ECS is meme
No it is not. Implement it and see the benefit.
Use perf command and compare the cache misses between your one giant loop for updating game objects vs multiple thread update similar data which are memory aligned.

>what's the issue with ECS?
hierarchies are the best model for expressing game logic

It will. I am putting one year into game dev.
Let's see where I can go. Here is my May implementation.

youtube.com/watch?v=6pYvGuWZHp0

what makes you assume you have to use ECS to have aligned memory?

If you're only using cryptographic primitives, maybe a library like nettle would be easier to use than openssl.

If you are making your own 3D engine you will need alot longer than a year to see the fruits of your labour

best of luck to ya

I did this in 5 months. I started with no knowledge of graphics api. I didn't even know Init, Run, Update is a thing.
I am betting my life in one year.
Currently learning some software design principles so that I don't fall into performance issue when I reach AI implementation.

I guess I will make it. 3D is easy.

Functional programming is actually good

you are going to need 5 years to turn that into something people want to play, and thats if you're lucky

My captcha is getting out of hand.
fuck moot we are literally training google neural network for free.
What are some other places where you guys hang out?
I am on the verge to stop posting.

just buy a pass

In order to use magical portability you need to standardize certain things.
this is one of them

People can play meat boy and undertale and papers pls, they can play any shitty game. They are just sheep.

I'm saving up $200k to move to South Dakota to some small city, with decent internet connection and retire
If I need more, I can work as a part time consultant

you are not going to make it with that attitude

Works on my machine

this is my 11th year posting.
i will not buy a pass to shitpost

giving money to japanese moot is the lesser evil compared to training the jewgle bot

noice

prease

Attached: 1530617543823.png (523x392, 166K)

why is everyone in board either an FP zealot or a hermit holed up far away from society who only cares about c/c++

theres plenty of c++ in society, step out of your web programming bubble

hahahaHAHA

Why user. I am not competing with you just being confident.

I think your best option would be to do neither.

don't respond to trolls

Attached: stop.jpg (225x225, 13K)

Well done. Time = money = freedom

everyone else has less free time on account of having a job

plz help

this has nothing to do with compeition, your confidence is misplaced, if you want to make a game in a year you need to use someone elses engine, and having the attitude that quality doesn't matter will definitely not get you anywhere
I'm trying to help you

most programs you use on your pc are written in c++

I use a mac

ok well I won't judge just keep it to yourself and we won't have a problem

Read this Operating System Concepts Silberschatz.
It has a chapter on memory.

Attached: Snippet.png (1075x641, 68K)

void foo();
void foo(...);

void bar() { foo(); } // calls foo(...)
justify this sepplets

unblock google tracking and log into chrome to speed it up

I want to program with senko-san

Here, I can parse lines.


#include
#include
#include
#include "config.h"

#define CONFIG_LINE_MAX_LEN 256

void parse_line(char *line)
{
if (!line) {
return;
}
size_t line_len = strlen(line);
char tmp[CONFIG_LINE_MAX_LEN];
char *separator_p = strstr(line, "=");
if (separator_p == NULL) {
fprintf(stderr, "[-] Failed to parse config line.\n");
fprintf(stderr, "[-] Config line: %s\n", line);
return;
}
size_t key_len = separator_p-line;
if (line_len

Attached: 1482721002570.jpg (3000x3000, 1.51M)

>submit to the jewgle overlord
How about no?

?

Thank you!

this is the most retarded way to resolve this overload

that code refuses to compile with both g++ and clang++, tard.

I have seen some retarded sepples code but nobody would write anything like that in real world.

I want to make a shitty roguelike for my own pleasure, what’s the best language to accomplish this? I assume C++ is still dominating the video game market?

you can make a roguelike in any language that can put text on the screen. they have no performance requirements

he said a roguelike not a rogue clone

there's a difference?

hiro is based

yeah, google captcha is truly painful. we did talk about that on hacker news yesterday.

kevv.net/you-probably-dont-need-recaptcha/
news.ycombinator.com/item?id=20158386

don't suck up to him, he doesn't even come to this website.

Attached: 1553848578789.jpg (824x478, 143K)

>we did talk about that on hacker news

pls do not bully hiro

captcha was implemented because of incessant spam

Attached: 1547024499927.jpg (1272x704, 163K)

doesn't mean you have to go with google's implementation.

yeah you really expect Jow Forums devs to implement their own solution, they can barely make a working pass system

not their own solution but they did add google's recaptcha, no? so they could add another, less annoying one (eg: phpcaptcha.org/)

I'm sure that's why right after implementation of a training tool on a site with unseen human traffic m00t went to work for google.
Im sure its coincidence.

no it was a few years before that but by all means continue being retarded

HE SOLD US ALL
though not lying I would've done the same to get into the google maps team jp and do fuckall to earn money

Attached: was it worth it moot.jpg (2488x1600, 451K)

why can javascript devs do everything in the world but I can't fucking build a web front-end without javascript and css

this is so unfair reeeeeeeeeeeeeee

>he thinks getting management position at google is an instant decision
based retard