/dpt/ - Daily Programming Thread

Previous: What are you working on, Any Forums?

Attached: 1556703578459.png (1434x1472, 463.44K)

Unity package for the Asset Store

an emulator. coming at this from 0 knowledge of assembly, pretty interesting stuff.

A compiler from a domain specific query language to interface with a sqlite database of a specific structure.

>domain specific
which domain?
also, if the sqlite database is of a specific structure, wouldn't it be simpler to just have a few functions on that structure instead of a full blown query language with a compiler?

How does sizeof work? How is dereferencing a null pointer not a problem when done with sizeof?

int* p = NULL;

p = malloc(sizeof(*p)); //dereference null pointer

>which domain?
A file tagging program I'm writing with its own query language. I originally had all queries run in a kind of interpreter using small functions but I encountered some problems with that and opted to just compile from my language to sql. The table structure has some recursive elements so I've been going back and forth on dynamically generating queries with recursive CTE's or doing those kinds of recursive joins in my program. I've decided ultimately that I would prefer to just compile to SQL then run rather than trying generating some large recursive structure and attempting to query that with inferior tools.

anything inside sizeof doesn't actually get compiled and run, the compiler just figures out the type and inserts the size.

trying to fucking figure out how pointers work. I just discovered what structs are and tehy seem really cool, but being unable to dynamically allocate arrays of strings without some double pointer stuff is annyoying. I have no issue using them on their own, but for some reason using pointers in conjunction with structs is just kicking my ass.

#include

void foo() {
int *p = (int *)malloc(sizeof(p));
}

foo():
push rbp
mov rbp, rsp
sub rsp, 16
mov edi, 8
call malloc
mov QWORD PTR [rbp-8], rax
nop
leave
ret

malloc my balls in your mouth

Is the hiring freeze/layoffs exaggerated?

ty anons!

doesn't that software already exist, file tagging program?

then you want to search files by search for things AKA filtering the set?

what

yes and yes. what is the problem, I'm not allowed to make things?

How the fuck do I do this? I've tried looking online and they suggest binary search but every single example I've seen is actually incorrect. They suggest throwing away the left side of the array with smaller median and the right side of the array with larger median, but this fails for e.g. {1, 2} and {0, 4}. Just throwing away the left side of the array with smaller median doesn't work either with the above example.

Attached: Screenshot_2022-07-22_00-40-07.png (821x197, 21.3K)

when i breakpoint mine shows push 4 for int

when i switch to 64bit, its mov ecx, 4 for int

i dont see a 4 in your code

Under section 34 of the rights of persons browsing /dpt/, a user must not reinvent the wheel when better software already exists.

>4 for int
int *p;

P is a pointer. Usually it has a size of 8.

It's a good thing that the right to pointlessly bikeshed other people's ideas is also included.

Is sizeof one of those macros that look like a function?