/dpt/ - Daily Programming Thread

What are you working on?
Previous:

Attached: 423ca128bb83b460a0d677195cd55d46.gif (346x360, 871K)

Other urls found in this thread:

cyclone.thelanguage.org/
docs.python.org/3/library/csv.html
twitter.com/RealSexyCyborg/status/827833201091440640
rugonamakit.com/
github.com/loki-project/loki-network
twitter.com/NSFWRedditGif

Hey its football user. This is probably the last day ill spend trying to get this to work. Im gonna keep working on my programming I definitely enjoy it and you guys have incredibly helpful. Anyone have any pointers about how i can plug my csv in this script to make it work?

sorry forgot the code

Terrible OP tbqhwyf

>people want better C
Literally just C with better standard library, like define the fucking API for threading and add compiler flag for
platforms that supports it. Now do the same for directories and file paths, basic data structures for systems that
support dynamic allocation.
Maybe smarter compiler like, recursive macros and type inference.
Saner types without the _t ending so every faggot doesn't have to rename uint32_t to u32 or allow multiple typedefs.
>Solutions proposed
GC
Uglier syntax than ATS
Name mangling
nonstandard ABI
Anything but what people want from C

ok so make a proper solution then instead of shitposting you colossal faggot

You forgot the pointer and array fuckery.
>Name mangling
Why should anyone care? You don't see it.
>nonstandard ABI
C defines no ABI

start implementing it instead of shitposting you colossal faggot

reminder that a very viable base is waiting for you to revive it.
cyclone.thelanguage.org/

docs.python.org/3/library/csv.html

deadlang

yeah hence the word "revive"

stay back satan

No thanks satan

that's 4 6's you dweebs, it means nothing

Fuck you satan

twitter.com/RealSexyCyborg/status/827833201091440640

c is fine for what it is just move on. this really reads like some guy championing modernizing fortran.

the warts are features at this point.

.

Attached: you.png (1872x1134, 268K)

Who do I have to blood sacrifice to get a better C? I'd like a Rust without the gay borrow checker

print "1\n2\n\nFizz\n4\n\Buzz\n..."

ya ive already read that. thanks tho

its called c++

You already have C++.

remove the templates too and i'll jump aboard

here's an idea: don't use em i don't.

literally abandoned my last open source sepples project because retards kept submitting pull requests where they brought in templates and i'm too autistic to say no

friendly reminder that STL is not part of the c++ language standard and you are completely optional for you to use.

i use vectors but only for parametrizing my own classes. (vector is lot more useful than vec3)

matrix rather. just use c++ its good now.

Fellow c++bros, is it a good idea to use variables as condition variables for the mutex locks/unlocks?
If in a multithread application and atomic is valid among all threads seems logical to use them as contidional variables for the mutex

Attached: brainlettttt.jpg (800x450, 37K)

Why not std::condition_variable directly at this point? It's literally made for that.

working on
> web socket server C/C++, protocol buffers
> client API in Python

websocket server allows clients to get data from circuit packs. Socket carries protobuf binary data back and forth

please just use a proper interlock compare exchange intrinsic instead of writing fragile non-performant code

I really love VSCode coming from Sublime Text, much more comfy, but resource usage really bother me, aspecially now when I want to go for a trip with old, lightweight laptop and still be able to code some. Vim is usable, but I'm not as productive in it as in VSCode.
Why isn't there modern, visual, open source editor made in something better than shitty electron?

yes

i want to nakadashi yukari

But using atomic seems easier to understand and to read...

I want to never have to deal with Java or C# or JS idiosyncrasies ever again

Currently using entities/components for a game.
For networking stuff, I have a Networking Component which essentially mirrors the entity its attached to and copies all of its other components and state data, and every x seconds it checks for any changes in these components and sends them to update the clients.
Is there a better way to do this? Im guessing I can keep track of arbitrary data fields with some kind of template metaprogramming black magic but I rarely ever touch template stuff.

Do it properly. That's the most important thing I've learned in my career. Model things correctly, don't use hacks and approximations.

Still working on my privilege checker --> rugonamakit.com/

but pretty sure I wasted my time though

Attached: 0cc.jpg (443x448, 96K)

if you don't understand your own abstractions stop using them.

HELP I NEED AN ADULT ;~;
i have been working on this for about 4 months full time and it ALMOST does stuff

github.com/loki-project/loki-network

Attached: shot.jpg (1770x1002, 119K)

I understand it and its fairly simple but I feel like holding an extra copy of an entity (two during the state change comparison) is bad design

guys I thought I'd learned how C's free works but I guess I was wrong.
I have this function that iterates and sometimes (when condition = true) calls itself recursively. The function also allocates memory for strings and frees them before returning. I thought this way I would be reusing the same memory multiple times after an instance has returned and I'm calling a new one. Turns out valgrind measures the exact same heap with and without free calls. Is my understanding wrong?

>cpp
rewrite

it has a public C interface which is good enough.
it was originally in C.

rewrite it in rust

pay me.

what are your pronouns?

pay/me/or-i-wont-implement-your-feature

Quake holds 32 snapshots of the gamestate FOR EACH PLAYER and uses them to make up for udp packet loss. The memory overhead is minimal. Delta compression can look messy but network bandwidth is infinitely more valuable than local memory usage.

>Mid tier: India, Brazil
>Low tier: Eastern Europe

Attached: srsly.gif (260x192, 1.94M)

post code
do you always allocate the same amount or does it change? what is the heap usage?

wtf. i unironically hold this shitcoin. what the actual fuck are you doing on Jow Forums? im selling rn. fuck this.

i have been posting daily for YEARS except when loki flew me out to Melbourne, ironically my progress ground to a slow crawl while there while the opposite was meant to happen :D

it all depends on the allocator implementation.

C is love. C is life.
Life* life = (Life*) malloc(sizeof(Life);

god bless youre and you familey

FUCK YOU, YOU ARE A STUPUD GENTLE PIECE OF FISH! I WOULD BIND YOU TO MY COMPUTER WITH MSDOS AND FORCE PROGRAMMING IN BORLAND C WOTH VOLKOV COMMADER.

Attached: 7qQy-Ld6lrw.jpg (200x149, 5K)

What kind of cheese is best?

It doesn't need a retard, faggot. Please take out the dildo from your ass.

Guys please help with C code. Function prime is supposed to take numbers from 0 to x and check each number if its prime, if it is - array[h] = i, and h++. But at the end it should iterate over array and print primes, but it prints single number: 35. Why? Its not because free(array) cause i tried deleting it, but maybe i fucked something with this memory management shit on initialising array, idk my first day with C
#include
#include
#include

int prime (int x) {
int* array = malloc(sizeof(int) * x);
int h =0;
bool prime;
for (int i=2;i

Here's a gross, imperative Racket solution that doesn't use remainder/mod:

#lang racket/base

(define (fizzbuzz n)
(define fizzvec (make-vector (add1 n) ""))
(define fizz 3)
(define buzz 5)
(for ([i (in-range 0 (add1 n) fizz)])
(vector-set! fizzvec i "Fizz"))
(for ([i (in-range 0 (add1 n) buzz)])
(vector-set! fizzvec i (string-append (vector-ref fizzvec i) "Buzz")))
(for ([i (in-range 1 (add1 n))])
(printf "~a\n" (if (string=? (vector-ref fizzvec i) "") i (vector-ref fizzvec i)))))

You should make FREE after FOR { } in function.

> 8 space tabs

sizeof(array) doesn't work like that, you're only printing 1 or 2 elements depending on your platform

oh sorry i thought you posted this as a parody.

I have only smartphone in this moment, so I can help not good. Firstly, it is better than you do
(int*) malloc(...)
Secondly, it is important call free() after working with array.
If this things not work, I think problem in ALGORITHM.

This guy said decision.

hi Jeff

Does anyone know a good system to use to model propagation of electrical waves and measure them in an arbitrary shape?

I basically want to model the Gauss surface produced by a collection of point sources. I'm sure there is an easy way to do this but I'm a baka.

whats /dpt/ book choice to study C#?

it's part of a bigger function so I removed some bits to make it more readable but basically this
typedef struct move{
int mv;
struct move* nextmove;
} move;

myfunc(int VALUE, list* TAPE, int X){
int A=0;
move M;
char* backup=NULL;
while(X>0){
M = GetMove(VALUE);
while(M.nextmove != NULL){
backup = ListToString(TAPE);
Update(TAPE);
A = myfunc(M.mv, TAPE, X-1);
if(A==1){
free(backup);
return 1;
}
Restore(TAPE, backup);
free(backup.string);
M = *(M.nextmove);
}
Update(TAPE);
VALUE = M.mv;
if(foo(VALUE)) return 1;
X--;
}
return 0;
}

/*
TAPE is a regular doubly linked list of chars
Update makes changes to TAPE, including adding new nodes
Restore reset the TAPE to the previous state
*/

ListToString(list* TAPE){
int tapesize=0;
node* cursor;
cursor = TAPE;
while(cursor=NULL){
tapesize++;
cursor=cursor->next;
}
char* string=NULL;
string = (char*)malloc((tapesize*sizeof(char) + 1));
string[tapesize] = '\0';
for(tapesize=tapesize;tapesize>0;tapesize--){
string[tapesize-1] = cursor->value;
cursor = cursor->prevslot;
}
return string;
}

Want to build an android dev portfolio. What's a good first app/project?

pizza
follow this order:
.net docs
albahari
C# in depth

Metaballs?

Pizza with meatballs?

reeeeee why the fuck are they called that
they're not balls in relation to balls, they're just balls
not him btw

>Q: In the last 5 years you had competition. But AMD did have 20% market share. What's different this time vs now? In the diff segments, where is the most competitive intensity

Yeah but it is mostly cheese

Attached: Копатыч_Постер.jpg (250x214, 12K)

well hard to say desu, It does seem like you frequently free a buffer and get one with the same size immediately after, which I would expect to reduce the memory usage. you could try making a backup before the loop, it looks like you back up and restore the same tape every iteration

also initialize prime

After a couple of months of working with javascript i no longer think of the object oriented programming i learned in school as object oriented. It's class oriented programming.

whats the difference

Pro C# 7 - With .NET and .NET Core | Andrew Troelsen | Apress

>meeting with product guy as dev for embedded team
>at end asks me 'whats your ambitions' or something

wtf was I supposed to answer?

Hello world.

Personally i'd like to build some kind of lightweight gps app, if i could just find the motivation to learn android programming.

Owning a bulge harem

>has been interviewed for the position of a Rust developer
Yet /dpt/ still claims it's a useless meme.

In traditional class based object orientation you have classes that serve as blueprints for your object and every object is an instance of a class.
In what i now think of as actual object orientation you don't. You just have objects, and you compose them on the fly. The objects are not instances of blueprints.

Even though javascript, and particularly js6, does have facilities for a more class oriented approach.

You do have ambitions, don't you?

thank you frens, here is solution. I thought for a moment that Euler answers are bugged, as i got correct answer after first try11:
[spoiler]
#include
#include
#include

int prime (int x) {
int* array = (int*) malloc(sizeof(int) * x);
int h =0;
bool prime;
for (int i=2;i

/dpt/ claims that about everything. Even C.

Please made one double linked list must be easy rigth?

Easy:
use std::collections::LinkedList;

fuck off pyccкий

I gave some autistic spiel about wanting to be an ultimate programmer and it was horrible

You can also use char instead of bool in stdbool.h, because in C:
1 - TRUE
0 (and other numbers) - FALSE
and bool variable in stdbool takes one byte as char.
For example:
char isBig = 1;
and
bool isBig = true;
are equivalents.

You can test it by while(1).

Attached: Копатыч_Начало.jpg (582x332, 69K)

Хoхoл или пpибaлт тyт тaкoй жeлчный?