[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1632779396808.jpg (569 KB, 1448x2048)
569 KB
569 KB JPG
Old thread: >>101341573

What are you working on, /g/?
>>
>>101363112
A program that translates basic C structures to Nasm structures for easier assembly integration.
>>
>>101363112
First for C++
>>
I wonder how many of those who advocate C++ actually know and understand the code that the compiler is generating for them. I cannot imagine there to be a lot of them.
>>
File: you_dirty_bitch.jpg (139 KB, 709x702)
139 KB
139 KB JPG
do not take the bait this easily
>>
File: 1548897321647.png (129 KB, 489x424)
129 KB
129 KB PNG
Sometimes I want to be really lazy in C and use fmemopen and/or open_memstream for some fairly basic string stuff, but that would add needless allocations to my program.
>>
>>101363878
Why don't you just answer the question? Or would that break your illusion?

>>101363979
Good call: https://codebrowser.dev/glibc/glibc/libio/fmemopen.c.html
c = (fmemopen_cookie_t *) calloc (sizeof (fmemopen_cookie_t), 
c->buffer = (char *) malloc (len);

And then there's the stuff in _IO_fopencookie ... honestly, if I was king of the world the people responsible for this atrocity would be servicing life without the possibility of parole.
>>
>>101363979
the user will totally care about 0.1 milliseconds added wait time AT STARTUP
>>
nevermind i thought you were talking about file mapping
>>
>>101364084
>he doesn't understand how abstractions work
>>
>>101364084
Nah, it would be throughout the life of the program, and you can't reuse the FILE handles really.
>>
>>101364132
are you talking about windows?
>>
>>101364294
No, C stdio FILE handles.
https://linux.die.net/man/3/fmemopen
I can't "retarget" the FILE handle to a different section of memory to reuse it.
>>
how is this possible?
>>
>>101364324
Why would you need to do that in the first place? No, seriously. What function do you need?
>>
https://eli.thegreenplace.net/2012/07/12/computed-goto-for-efficient-dispatch-tables

the C standard strikes once again
>>
>>101364360
>he is doing fizzbuzz regex in a different architecture again
so that anon was not schizofrenic.
>>
>>101364368
It's a very lazy way to do string manipulation.
fmemopen, you can just shit out a bunch of fprintf calls and not worry about accidentally overflowing.
open_memstream is even more powerful, with its own automatically resizing buffer.

It's actually fine for some more complex use cases or cramming some stuff into an API that only works on FILEs.
It's just it would be fairly inefficient to keep setting up and tearing these down for small things, which is what I'd be doing.
>>
>>101364434
sprintf/snprintf?
>>
>>101364400
I wonder if with the new C23 unreachable() macro,
switch (op) {
case OP_ADD:
...
break;
case OP_MUL:
...
break;
...
default:
unreachable();
};

or I guess __builtin_unreachable can provide the same codegen as that.

>>101364493
Has to be a single call. I'm building a string recursively.
>>
File: 240711-073459.png (707 KB, 600x600)
707 KB
707 KB PNG
added a startpos element to my music player ui format which is a general mechanism to specify the start area of an ui element which is transitioned to the end position with playback progress, so i can draw a circle over the progress bar which moves with playback
the progress bar fill also uses the same mechanism, which is an area of initial width of 0
also added a way to configure corner radius

>>101364434
>It's just it would be fairly inefficient to keep setting up and tearing these down for small things, which is what I'd be doing.
at least for glibc all *printf functions call vfprintf internally, even for the plain snprintf, so they're probably already doing this behind the scene
>>
>>101364518
Makes me wonder why this wasn't implemented as an [[unreachable]] attribute. Wait no, the better question is why did they even add attributes instead of providing the same concepts as implementation defined macros instead. That feels better integrated into C than attributes.
>>
>>101364956
>[[unreachable]] attribute
An attribute applies to a statement. I guess you could make it apply to the null statement immediately following it like
[[unreachable]];
, but then, it's like fuck it, just let the compilers do
#define unreachable() __builtin_unreachable()

>why did they even add attributes instead of providing the same concepts as implementation defined macros instead. That feels better integrated into C than attributes.
Because sepples already did it, and they seem to care somewhat about header compatibility.
>>
Integration tests for a small MMO engine I’m building. It’s an interesting question: how can you build regular tests over a complex, stateful, and time-sensitive system? Right now my solution is to inject a testing game loop “clock” that I can advance at will, which removes timing issues from the tests. When I introduce RNG I’ll have to use a static seed there too. There’ll still be race conditions that I need to handle somehow, like server updates coming in an arbitrary order, but that’s for the assertions to deal with.
>>
>>101365083
>how can you build regular tests over a complex, stateful, and time-sensitive system
You can't, which is why you take testability into account in your design so that you don't get an untestable mess.
>>
Is there a way to verify your ansi c/c++ code compiles on compilers new and old?
>>
>>101365870
gcc -ansi
>>
What does it take to make an OS? I'm morbidly curious about osdev.
>>
>>101365896
Schizophrenia
>>
>>101363112
>GCC Timeline
>GCC 12.4 June 20, 2024
>GCC 13.3 May 21, 2024
>GCC 14.1 May 6, 2024

??? Why do they update older versions? What's the point
>>
For C++
What is the point of making an interface/abstract class then inheriting that class to make your "base class" which is technically a derived class but it's actually concrete.
>>
>>101366293
Bugfixes
You don't drop support for an old version the second a new one comes out
>>
>>101366299
I guess mainly for gtest and gmock purposes?
>>
>>101366323
>You don't drop support for an old version the second a new one comes out
what's the reasoning behind this? I unironically do not understand it. You have a newer version for a reason, right?
>>
>>101366349
What OS do you use? If you're on Arch or similar then, yeah, you probably can, but Debianfags are often stuck on software 5 years old.
Also, major versions can imply a breaking change even with somehting like GCC as an omptimization/whatever may have changed that breaks on undefined behaviour. If some company doesn't want to rewrite and fix it they wont want to upgrade.
Think of some big program that you wouldn't want to upgrade to the next version for whatever reason, but you'd still want bugfixes.
>>
>>101365896
https://wiki.osdev.org/Required_Knowledge
https://wiki.osdev.org/Getting_Started
>>
>>101365896
the process of finding information is extremely silly with retard redditors from ten years ago lying to you every step of the way but aside from that shit is chill
>>
>>101366554
Have you ever opened a book?
>>
>>101366795
Why, do you need help?
>>
>>101366795
>yes yes goy go and scroll through 400 pages of information you have already read to find this little piece of information that some retard nigger for 12 years ago forgot to put in the index
no, i would rather go half insane by asking AI and browsing forums, thank you.
>>
>>101366957
pdfgrep -in -A5 -B5 yourPdf
>>
Random question.
Are there any modern toolchains (for any language mind you) that compile applications for Win16 (aka Windows 3.x)?
>>
>>101364360
-Wl,-no-pie fixed this
>>
>try to study programming
>get really tired and unable to concentrate after 10 minutes
how to fix this?
>>
>>101368990
Stop using t*kt*k and learn some self discipline
>>
>>101369010
I don't use chinese spyware "apps" or social media.
>>
>>101369064
Take stims then
Or find something you actually enjoy and don't need to force yourself to do
>>
>>101369080
I only enjoy playing video games, but I feel like I'm wasting my time when I do that.
>>
ChatGPT 4 is so garbage. Legit was given examples of Dependency Injection, Facade, and Respository with horrible examples where they were wrong or were basically 1:1 to each other when I was asking about recommended designs for a use case.
>>
>>101369449
Artificial Indian
>>
>>101363271
do you take things like alignment into account?
>>
>>101368990
>>101369177
Wow, that sounds like me
>>
>>101369804
nta but obviously he is taking that into account
4chan is a technologically-literate website, newfag
>>
im new to neovim and i'm using lazyvim. When i open a file using neo-tree it looks like it's opening a new tab, but i'm wondering - is it really a tab?
When i press `gt` it doesnt cycle through the files ive opened. `gt` only cycles through tabs i've opened myself (not through neotree)

What are these called and how do i open files as tabs in neotree?
>>
File: File.png (145 KB, 1843x850)
145 KB
145 KB PNG
I've been working on a script for a few years now (I come back to it every now and then)

I'm reading in this old 90s binary file and trying to extract the graphics from it. They're stored as bitmaps but the format of this file is a fucking mess. Essentially, the very start of the file has the bitmap names and the byte size, but the actual bitmap data is all over the place. I have no idea how to map the BM headers to the file names. Some of the lines have a single bitmap name followed by the header, and those are easy enough to match and they come out fine. But some lines have multiple names and BM headers which I can't seem to figure out how to get them to match up.

This bitmap format is so old that it doesn't have the file size in the header which is a shame. That would have saved me so much work. If anybody wants to take a crack at it, I can upload this binary file somewhere for you to look at.
>>
>>101370586
those are buffers and the line on top just shows you what files you have open in that buffer. tabs in vim are basically a container for a new open window, kind of like popping out a tab in vscode into a new window.
>how do i open files as tabs in neotree
rtfm
>>
File: 1720456003084285.jpg (141 KB, 1080x2048)
141 KB
141 KB JPG
Hello complete retard here. Is it good idea to make something that reads data from csv file using c++ and then hands it over to sql for transformations and shits out the result csv file
>>
>>101370937
>post vrtroon shit
>ask dumb question
Extremely unexpected, maybe an once-in-a-lifetime occurrence.
>>
>>101371161
Mean. You don't get to be a cunt unless you contribute.
>>
>>101371223
I will be a faggot whenever I please.
>>
File: 1704066119437384.png (76 KB, 264x294)
76 KB
76 KB PNG
>>101370659
for me it was
>pause emulation
>note addresses in ps2 gpu registers
>load file in crappy opengl program with those addresses as file offsets (with some controls for further scanning/narrowing the texture window on the file)
iirc each channel of the image was stored contiguously rather than rgba channels being interleaved, so initially the texture just looked gray

i used this to extract the credit images from suikoden 3 (what a waste of time)
>>
>>101370937
All languages with a standard lib have an easy way to open a file, parse all lines into an array of strings, and split a string into an array of strings based on a delimiting character.
The real question is if you can stomach whatever driver you got to bridge your program to your database.
>>
>>101371538
is this AI?
>>
>>101371554
nyooo
>>
File: m.gif (495 KB, 600x300)
495 KB
495 KB GIF
>>101363112
HASKELL!
>>
what's the best way to measure the memory consumption of a program on linux? I'm using time -v and saving the "maximum resident size".
>>
>>101364827
>COOL&CREATE
good taste
>>
>>101371223
no, no he's right
>>
>>101363112
babymaking sex with marisa
>>
>>101363112
Custom Minecraft factions plugin. Plugin development is much more fun than I expected
>>
>>101370659
What game/program and what is it written in? I would imagine it's either off-the-shelf or a modification of something that was
>>
>>101369804
I'm working on parsing right now but mostly it's for quickly generating new pointer packages to trivially pass stuff by reference, and then unpack it in assembly. It's for easing the replacement of whole subsystems with asm, not for cache efficiency while processing an AoS. It's not that hard to implement basic alignment padding to match C's, though, and I'll probably do so.
>>
>>101371538
I get that anon but if sql is used for databases purposes for within certain software wouldn't it make sense to also use it for data transformation.
>>
File: file.png (91 KB, 876x865)
91 KB
91 KB PNG
rate my main function /dpt/
>>
>>101374901
looks like shit
no idea what it does
>>
When writing side-effect-heavy code with lots of global state (caches, databases, GPUs, sensors), how do you avoid writing 1000s of lines long functions? When there is basically no code duplication, every time i try to pull it apart, i end up with many small functions each with very specific purpose, that absolutely have to be called in a very specific order.
This problem is exacerbated in languages without the block scope, where you absolutely have to write millions of small functions to avoid name shadowing bugs.
>>
File: 1639362052883.jpg (2.87 MB, 4093x2894)
2.87 MB
2.87 MB JPG
I want to create a python binding of C++ code using pybind11 that takes in only pickleable iterators. That is to say, in python, calling func(it) should only work if it is an iterator that is pickleable. How do I do this? Something like .def("func", [](__?__ it) { ... }, py::arg("it")) in C++ I assume, but what goes in the ___?___ ?
>>
>>101375269
you can't unless you just immediately pickle it
>>
>>101370659
>
post the binary I'll give it a try
>>
>>101375486
Hmm, really? Can't I at least check for __getstate__ and __setstate__?
>>
>>101375040
Just assume the user who's going to end up using your code wants to use more than one such (cache/database/GPU/sensor). How would you allow that?
>>
>>101375636
i guess? but you wouldn't know if it was defined to just immediately throw not implemented?
>>
>>101375650
I would parameterize the 10k line long function to allow for multiple external devices, i guess. Then add loops over multiple devices wherever necessary.
>>
>>101375673
That's fine for me, that's the user's responsibility. The same is true for taking a vanilla py::iterator where the __next__ method throws a not implemented error, right?
I was just wondering what the idiomatic pybind11 way to achieve what I'm trying to do is (just taking a py::object and checking for the methods, or is there something special)
>>
>>101375721
it wouldn't work with pybind overloading btw, unless pybind has a special exception it can catch to try another
>>
>>101375721
>>101375747
So I guess the "proper" way is to write a type caster by specialising PYBIND11_NAMESPACE :: type_caster for a new type with a py::object or py::iterator in it
>>
>>101363500
why does everyone use C or C++ why does C+ not get any love?
>>
>>101375716
>parameterize
How? And what if there are blocking calls within that function for which you don't want to issue kernel threads for?
>>
>>101363577
I love how people are too afraid to answer. That's cognitive dissonance for ya.
>>
>>101375040
Can you give an example?
>>
>>101363577
I wonder how many of them use C++ at all
>>
>>101375757
The pybind11 custom type caster documentation's warning that only experts should use it scares me. I suppose I can just check for the relevant get/set state methods then? What's the overloading issue you were referring to?
>>
>>101375787
>too afraid to answer.
You mean they don't care about your stupid question
>>
>>101375956
i mean in pybind you can do stuff like
.def("x", ...)
.def("x", ...)
and have it pick the right implementation based on the arguments
type_caster is what it actually uses to convert fields/arguments/results
>>
>>101375962
This. It's obvious bait and C++ programmers are generally too busy tearing their hair out over pointless template magic to care if someone's talking shit in the daily fizzbuzz thread.
>>
>>101376042
I see, but overloading isn't relevant to my use case is it?
>>
>>101375962
You mean, they don't care justifying poor life choices? Yeah, that makes sense - I wouldn't want to be reminded what an utter retard I was twenty years ago, too.
>>
>>101376224
I for one am happy that I recognized early in my life that complexity is the enemy, and thus went for the simplest languages. Not easiest, but simplest.
>>
>>101363112
full marisa and reimu image pleas?
>>
>>101376494
So you went for C, not C++, then?
>>
File: 1720741737809.jpg (172 KB, 1575x879)
172 KB
172 KB JPG
>>
>>101377071
A mixture of assembly and C.
>>
>>101377248
>assembly
>200+ primitives
>yeah bro i went for the simple language
kek, you are a retard trying to be edgy, your lust for internet autism was stronger than your intellect
>>
And the most niggerlisious line of code I had honor producing this summer award goes to this cutie
using allocator_type = std::allocator_traits<Alloc>::template rebind_alloc<node_type>;
>>
File: 1689158938082799.png (118 KB, 612x729)
118 KB
118 KB PNG
>>101377392
>he does not understand the difference between "easy" and "simple"
>despite highlighting
>>
>>101377468
>he doesnt understand the words coming out of his mouth
anyway fuck off already

>>101363112
just realized i have been using "hashmaps" extensively, thought they were some kind of cryptic hashing thing idk
>>
File: 1701982354546760.jpg (71 KB, 500x500)
71 KB
71 KB JPG
>>101377685
>he doesn't even understand the words "easy" and "simple"

>fuck off already
Make me. We all know you can't.
>>
>>101377795
>replied that fast
it sure is summer.
>>
>>101363112
fixed the absolute MESS that was the kernel
>disks abstraction was so volatile that i hadnt even written the driver interface
>dont get me started on paging
>wrote pci driver and device enumeration (although i have to clarify the driver attaching method which is driver/device_type specific)
>rewrote the memory, process and thread syscalls, they scaled fine
shit is taking shape, i can wrap all syscalls aside from io control already
>>
>>101378196
>which is driver/device_type specific
this is more about the fact that the method is within the driver code and it is based on the standard for the device_type
>>
>>101378196
Is it a motorcylce, or a 1970s mainframe?
>>
>>101378263
it will be a 1970s mainframe but the user environment is not well defined (i acted on it in the structures and code already though) hardening has yet to be done, similar to above i have given the room in the structures and code but i havent written like if newlen < previous_len return NULL in mem_realloc type of thing because it makes things harder to work on
>>
>>101377248
Ah the patrician choice - very based.
>>
>>101378608
As long as compilers are unable to generate optimal code for in-order architectures there will be a need for assembly programmers. It just is what it is.
>>
frens pls explain the difference between this python
list[tuple[int, int]]
and this
list[tuple[int, int],]
>>
>>101378754
the C compiler would scream at you if you included the last comma but now it doesnt anymore
>in python
i have never used python
>>
>>101378754
one of them has an ugly redundant comma
>>
>>101378754
The second explicitly has a one element tuple. I would guess there's no practical difference with linters just treating it the same as the first, but I can't test it on my phone
>>
>>101363112
sex with flandre-poster
>>
>>101369177
Make games then
>>
>>101369723
Underrated post
>>
I'm trying to get location data from CCLocationManager, I have all three privacy location messages set in the plist and am calling
let locationManager = CLLocationManager()         locationManager.requestWhenInUseAuthorization()


why am I not getting a prompt to allow location data on either the iOS simulator or my phone?
>>
>>101379498
this is something you should be asking AI
>>
>>101379534
ai suggests the same shit that stack overflow does, ive done it, still no prompt
>>
>>101363112
Mulling over Dependency Injection... one of my peers loves this kind of abstraction. He'll do it in his personal project just for fun, spending countless hours just abstracting and abstracting until finally he can write actual program behaviour at the 7th level.

I don't dispute that he's clearly quite intelligent to be able to come up with these and for them to work, but is there any value in it beyond practice if you spend more time architecting than delivering features?

Every example I see online of Dependency Injection is highly contrived, and often require foresight about the product's direction
>"the business(es) want to do the same thing 5 different ways"
or
>"We made a class to do task A, but now we want it to do task Av1 Av2 and Av3 and we've used it in a bunch of places"

Sounds neat, but you've still already done the work to spread class A everywhere. Unfucking it will still need to be done DI or not without divine foresight.

What's the point? Does DI only really apply to huge codebases?
>>
>>101363112
bros i have just struck fucking gold i am the biggest high
>>
File: performance.png (33 KB, 523x212)
33 KB
33 KB PNG
just spent two hours to save two miliseconds
>>
>>101380846
yeah because you are retarded, now you are going to waste more hours when you have to read that simd nonsense again in the future
Funny thing is you are 100% going to spiral into the sunk cost fallacy and keep things that way
>>
>>101363112
your mom
>>
how to learn Solidity? I need guide for absolute newbie
>>
I am applying for a promotion to programmer. Wish me luck friends
>>
File: 1530819512144.jpg (174 KB, 1320x1014)
174 KB
174 KB JPG
rust
yay or nay?
>>
File: qtptj.jpg (21 KB, 400x400)
21 KB
21 KB JPG
>>101382483
>>
>>101383112
please no bully i am a webdev
aiming to get a job at vercel
>>
>>101378754
None, Python is dynamically typed.
>>
>>101378754
tuple[int,int],
is a tuple containing a type which just so happens to be a type of tuple
>>
>>101374901
looks great. i can tell at glance what it does
>>
>>101380344
You can get more theorems for free. f :: Int -> Int -> [Int] -> [Int]
is allowed to do all kinds of things with the ints, but if instead
part of f is supplied as an argument to the smaller new f, the
most general type will have some Ints as "a" others "b" and then
it's clear from the type whether or not the count is being added
to an x coordinate. Many languages have big rituals for passing
functions as arguments, and the verbosity spills over into their
pedagogy.
>>
>>101383676
Is this the visitor pattern?
>>
>>101363112
what is a std::initializer_list exactly (i know what it is conceptually & how to use it) and how does it make it possible to call a constructor with {} instead of () ?

i know you can use {} for aggregate initialization, however apparently if you have a constuctor that takes a std::initializer_list, then you too can create it with {}. How? how exactly is that interpreted?

even if std::initializer_list is an aggregate type itself it doesn't make semantical sense because then it should be like this
Foo foo( {} );
and not like this
Foo foo{}
>>
>>101382483
>>101383146
Take webdev questions to the webdev thread, this one is for C programmers.
>>
>>101383907
like is std::initializer_list just given special treatment? i thought the c++ spec didn't do that

what if im not linking with the standard library but still want this behavior?
>>
>>101383938
>i thought the c++ spec didn't do that
it does sometimes
>>
>>101384016
thats stupid and gay
>>
>>101384034
no u
>>
how do I save my work to gitlab when I'm working on a repository but don't want my changes to appear on that repository yet?
>>
>>101383907
>>101383938
C++11 generalized the concept of a converting constructor to be any non-explicit constructor, and in order to make that work with constructors that take more than one argument they added initializer_list to hold those arguments. They were not intended to have any other purpose than that.
>>
>>101384104
was wondering this myself a while ago
seems the answer is you either have a personal dev branch, or you simply dont work in a way where you end up with unfinished changes.

Basically change your workflow so you are making incremental small atomic changes at a time, so you never end up with a bunch of unfinished work.
>>
>>101384104
just push and then rewrite history later (squash the temp commit) with a force push

force pushing isn't as bad as people say. Its perfectly fine if you're the only one working on a feature branch or repo. Its only bad practice once youre working with other people
>>
>>101384174
is that really how you're supposed to do it? even for mega projects that could have thousands of in progress features? wouldn't something like chromium have millions of branches (people WIP and then stop and never delete the branch over many yaers)
>>
>>101384318
well you have to remember in most git flows typically people fork the project and work on their changes there. So yes its perfectly fine to commit temporary things, then clean them up later with a force push before submitting a PR to the real repo. Its never going to show up in the real repo.
>>
>>101384318
if you're just working on your own project (not an organization project) then you can just create a separate feature branch that you push temporary changes to, and eventually clean up before merging into master.
>>
>>101384318
and if you really want to hide even your temporary feature branches then you can try something like creating a fork of your own repo, mark it as private then commit temporary changes to that, and when they're complete you clean up the history and commit it back to the real public project.
>>
In C++, is a float + an int treated as an int or a float?
>>
>>101384945
float
>>
>>101384945
https://en.cppreference.com/w/c/language/conversion
>>
>>101384318
If you're using a GitHub/gitlab style workflow, all of those features are going to be on the respective developer's forks of the repository, not cluttering up the main one.
Plus branches are very cheap anyway.
>>
>>101385018
so 3 copies of the repo need to exist?
>original
>forked remote
>forked local
>>
>>101385046
yes. The original and local make sense, you need the forked remote so you can push personal things and work on them at a different machine
>>
>>101384985
Sir, that clearly says C Language.
>inb4 they're the same
>>
>>101385046
If it's just something you're doing on your own, the original and forked remote are the same thing.
But yes, you can easily end up with many, many "versions" of a repository. Even working on multiple computers is technically another version.
>>
>>101380344
For actual DI, you're usually going "give me my data store, my logger, and a way to send an email, and I'll provide a FOOBAR web service implementation that you can expose". It's not too complicated, provided you pretend that none of the complexity of actually doing those things exists; sometimes they're actually simple, but sometimes they aren't, and your service code doesn't need to care either way.
(The really bad alternative that used to be common was to have your FOOBAR service implementation go off and make all those things it needed itself. That really sucked and made apps awful to work with.)
>>
>>101383901
Every other design pattern is a higher order function.
>>
>>101363112
>git newbie
>link repo in a job application
>"holy shit i have written slurs all over the code"
>blame is unrecoverable, delete repo
>paste all files, cleaned, again
now they are going to say "hurr durr you plagiarized" or whatever the fuck
niggers

i just want to say nigger man D-:

God i wish i had seen the thread earlier
>>
>>101386002
How is hr allowed to 'grep "*gger"'?
>>
>>101386066
someone would be reading the code supposedly, I am applying to some small-time company that works within the country, not FAGMAN shit
>>
>>101386002
no one will look at your github. in an interview they might ask what sort of projects you work on, but that's it
>>
>>101386153
The reader, if they exist, will be based.
>>101386177
So they need a github IQ and personality test.
>>
>>101386002
Just say you plastered nigger all over the code to stop AI from copying it.
Guaranteed cybersec role.
And make the license GPL+NIGGER.
>>
>>101386458
GPL is already a nigger license so you don't need the modifier
>>
File: oyvey.png (73 KB, 920x1110)
73 KB
73 KB PNG
>>101386508
>>
File: us.png (222 KB, 524x233)
222 KB
222 KB PNG
>>101386508
>>
>>101363112
yet again used object oriented where it was not needed and it didnt scale, fuck oop, the only good thing about c++ is being able to use the name of a class as a type with no "struct" before it
>>
>>101386822
#include <stdio.h>

struct Meme {
int x;
int y;
};

typedef struct Meme Meme;

int main() {
Meme m;
m.x = 1;
m.y = 2;
printf("%i %i", m.x, m.y);
return 0;
}

behold, C++
>>
>>101386990
thats c
>>
>>101386990
>prints "1 2" as expected
i dont know what ur implying with this post
>>
Need to fill up my github and get my shit together.
Wasn't there a website version of that one "roll for a project" image that basically gave you random programming projects?
>>
I am working on a BTC ticker so I can watch myself go broke in real time.

I'll throw my portfolio in there today so it can be real suicide fuel.
>>
>>101387777
I forgot that arrays exist again.
>>
I'm lost on my journey to become a programmer. I studied a bit before I went to college and during my first year of cs we did lots of coding. Now I'm halfway done with my junior year of college and I feel like I've regressed. The entire last year I"ve just been doing paper and pen questions like describe a bubble search or something about djiskra's paths I already forgot. I feel like I'm not moving forward. My college sends us these openings for entry positions and here is what I need to know for a starter job

-Basic knowledge and understanding of Microservice Architecture, Containerization and Orchestration
-Understanding of Agile, Helm, Jenkins, Bitbucket, Gradle, Maven, MQ, and Kafka
-Experience with and knowledge in Linux and Bash and basic scripting like Unix.

I don't know any of that and hours on google and I can't even find a good way to learn it. How is it actually done how do you actually go about acquiring skills to get your first job.
>>
>>101378122
>still haven't fucked off
You sure must be feeling mightily powerless by now.
>>
>>101388325
That's some "junior position expecting 5+ years of senior experience" HR garbage. Don't worry about it.
>>
File: file.png (29 KB, 689x547)
29 KB
29 KB PNG
gonna attempt to write a bencoding decoder today
tomorrow i will make a torrent file decoder
and who knows after that
>>
>>101388325
>-Experience with and knowledge in Linux and Bash and basic scripting like Unix.
omg based colleges

>Kafka
glad i dropped out, this isnt even about programming or mathematics

>how about you help me faggot?
kek no
>>
>>101388325
If you know Java you can apply.
>>
>>101388531
wtf does the s do at the end of C strings?
>>
>>101388713
its a user defined string literal
just converts const char* to std::string so i can use the + operator like its python or something
>>
>>101388724
wtf we don't do that in python anymore. Doesn't sepples have std::format now? F-strings when?
>>
>>101388666
I only know Java, but I don’t know how to do anything useful in it. Probably the most advanced thing I coded in Java was rearranging linked lists, stacks, queue, or recursion
>>
>>101388734
>std::format
yeah we do

i didn't mean anything specifically python related i just said python as in any high level language where you can just add strings together easily like that. Usually in c/c++ you cant just + or == c strings because they're pointers
>>
File: Beetle.jpg (14 KB, 224x225)
14 KB
14 KB JPG
>>101388325
>Experience with Kafkaesque software
>>
>GitHub Support won't remove non-sensitive data, and will only assist in the removal of sensitive data in cases where we determine that the risk can't be mitigated by rotating affected credentials.
scandalous.
>>
Boy, I'm glad I never uploaded any code into github, what with all the many times I called Torvalds and Gates a bunch of raving faggot niggers. Terry was right yet again.
>>
>>101389094
>spam nigger
>account banned
>repo nuked
total victory
>>
>>101389094
There's essentially entire criminal enterprise in the chat bot thread where scrapers find corporate AWS credentials off github and then sign them up for the AI services and then take crypto payments in exchange for proxy server tokens to prompt on those accounts, mods don't care, the people who do it are basically e-celebs and 50% of the threads posts are gossip about them
>>
I haven’t coded in 2 weeks now. I feel like such a sack of shit. I did a 20 minute review of all the notes I’ve been taking at least and did some small practice with string manipulation in C++. I really need to keep myself more accountable.
>>
>>101389886
Your notes mean nothing and if they did, your 20 minutes means nothing. You need to suck it up and and accept you do not like programming or you need to start working on a project. Take it from someone with many text files of thousands of lines of notes that you will absolutely not get anywhere without applying any knowledge you've mustered into something that isn't purely theoretical. If you want to get good you absolutely can and WILL, but only if you abandon everything giving you an artificial, false sense of progres. If you don't genuinely want to dedicate your work life (or free time, depending on what your goals are) to this shit then there's no harm in accepting that your corporate assigned interest wasn't a match and trying something else instead.
(friday night drunkposting)
>>
>>101389886
just turn the notes into annotations bro
>>
>>101390034
based
(saturday morning of the day after posting)
>>
>>101390034
NTA, but:
There is a time and place for notes and documentation, like
>this is how you set up privileges for SQL accounts
>this is how you set up your firewall
>this is how you limit the amount of TTYs the kernel spawns at startup
Note how none of this has to do with programming though.
>>
>>101390076
I agree, but none if that is relevant if you aren't competent to begin with. I don't regret documenting my work, I only regret documenting my textbooks instead of applying the knowledge sooner.
>>
What do you use as a general record type in Python? There are nameduples (immutable), dataclasses (requires type annotations and generates a bunch of useless class methods by default), SimpleNamespaces (dict with \__getattribute__), plain classes (init boilerplate), plain dictionaries (no way to tell what attributes are there without debugging or analyzing the program), and probably a bunch more crap. I don't know what i should use, except that i probably prefer a mutable type for the general use case.
>>
>>101390097
dict is builtin, and is printable and serializable by default. No need for meta programming bullshit that are dataclass and namedtuple. You miss out on slotted attributes that classes may have, but if you care about optimization, python is always the wrong choice.
>>
>>101390034
lol you’re probably right. I need to stop coping and just code. The notes were helpful for me at least since I was starting from absolutely 0 knowledge and writing shit down helped me with learning the very basics/fundamental concepts of programming.

But since I can code the basic shit now it’s time I take the next step and pick up a project and get to the next level.
>>
>>101363112

set(PRECOMPILED_HEADERS 
<raylib.h>
<rlgl.h>
<fmt/core.h>
<vector>
<algorithm>
)
foreach(header IN LISTS PRECOMPILED_HEADERS)
target_precompile_headers( waveformgen PRIVATE ${header})
endforeach()

is this the wrong way of using precompiled headers with cmake? I have been doing it like this instead of the suggest write everything to a pch_common.h and include that. Cmake seems to take care of creating the cpp file as well
>>
I can't fucking stand the delay in starting up the python interpreter.

There's a fucking noticeable lag spike that sends me insane. Other than that it's a pretty good language to use.
>>
File: train_glegle.png (1.28 MB, 884x1274)
1.28 MB
1.28 MB PNG
>>101363112
>tfw dense manual shit
>>
>>101390191
I highly doubt that’s your face.
>>
>>101390190
>pretty good language to use.
>>101390097
>no record type that everyone can agree on
No thanks bro.
>>
>>101390209
>newfag doesn't know the dofference between tfw and mfw
>>
File: 2024-07-13-022231_scrot.png (93 KB, 999x1026)
93 KB
93 KB PNG
It's finally coming along...
>>
>>101391255
Hi, Matt.
>>
>>101391264
Hello anon
>>
>>101391255
extremely based Matt.
>>
>>101363112
intel machine check scouter + bookkeeper + helper functions + interface functions that read the book and call the helper functions
(i had forgotten this was a thing until i read about it again in the uefi spec lol), then doing RTC read/write
>>
julia is really nice
>>
>>101392563
the language or your coworker
>>
>model specific error codes (there are global ones too though)
>on these processors all exceptions are unrecoverable...
>*lists all processor families ever*
officially never the fucking mind, i will make it a bitdump with the msr names when i have a logging subsystem, rtfm, you can do better than my software can do
>>
I think I'm going to start using Swift as a thin wrapper around C
>>
>>101394017
Please do. We all need something to laugh at.
>>
>>101394088
post body
>>
File: post_body.png (941 B, 648x28)
941 B
941 B PNG
>>101394108
Sure, here's a POST body.
>>
File: 1705634443993133.png (13 KB, 838x173)
13 KB
13 KB PNG
decided to make a wee language, I only need to write the evaluator to make basic arithmetic work, but I paused that and had some fun with working on the repl first. the main thing I want to try out with the language is going to be function calling syntax that makes piping easy, it's going to work more or less like this:
fn repeat(@str to_repeat, int times) str {
return str * times;
}

fn to_third_person(@str base) str {
return "He said: " + base;
}

var new_str = "Hello, world"
@ repeat(2)
@ to_third_person();
// He said: Hello, worldHello, world
>>
>>101394209
THAT'S A LOT OF NULLS
https://www.youtube.com/watch?v=FR4iRawfvNA
>>
>>101394404
>rust
>>
Why didn't /g/ tell me to code with what you like? I'm doing it right the fuck now. I'm thinking of making a local booru browser at the end of this all.
>>
>>101394722
If you use an upstream/proxy server you're doing it wrong.
>>
>>101394555
Are you mad about the "fn"?
>>
>>101382483
Yes if you're planning to become a MTF tranny. No otherwise.
>>
>>101394827
i look too manly to transition, so that's a no
what about zig? do you guys use zig, it's being used on bunjavascript
>>
File: 1623434570799.png (78 KB, 195x209)
78 KB
78 KB PNG
>>101394873
>i look too manly to transition, so that's a no
Since when has that stopped anyone?
>>
File: 1509394868758.png (325 KB, 477x682)
325 KB
325 KB PNG
>>101394960
i wouldn't look as cute as i would like to
>>
>>101382483
yay
>>
File: 1619357148006.png (1.08 MB, 1248x1676)
1.08 MB
1.08 MB PNG
>>101395010
Again, since when has that stopped anyone?
>>
>>101394960
>>101395124
Cease and desist groomer
>>
>>101395124
this is the maid guy by the way
>>
File: 1622883471181.png (61 KB, 205x266)
61 KB
61 KB PNG
>>101395167
I haven't even started posting the hideous stuff.
>>
I wrote a random number generator
 double v1=0.0;
double v2=0.0;
double FNf(double n){
return n-(int)n;
}
double FNr(){
v2 = FNf( v2 + 0.0135298797218497987891 );
v1 = FNf( v2 + v1 * 41968.471825827185821 );
return v1;
}
>>
I want to compute the distance between 2 points A and B (e.g. Driving from California to New York)

I could compute the distance in a straight line given their coordinates but that's not accurate.

How would one compute a realistic approximation (e.g. driving by car)?

thanks
>>
>>101396274
By doing your homework by yourself.
>>
>>101396293
what?
>>
>>101396274
Using the google maps API or something.
>>
>>101386990
>struct Meme {...};
>typedef struct Meme Meme;
Why is this allowed? Is C++ retarded or something?
>>
>>101396301
You heard me.
>>
>>101396332
i thought about that. what if there are multiple routes one could take?
>>
>>101396274
>I could compute the distance in a straight line given their coordinates but that's not accurate.
the absolute state of summer

this is some 8th grade level question by the way
>>>/rules/2
>>
>>101396375
Refrain from posting if you don't have nothing to contribute, you retarded cunt

last reply you get from me
>>
>>>/rules/#2 *
>>
File: 8654385933135000.jpg (25 KB, 400x400)
25 KB
25 KB JPG
>>
File: video1.webm (3.17 MB, 1002x552)
3.17 MB
3.17 MB WEBM
>>101396408
What feature should I add next?
>>
>>101396424
dope
>>
make the UI less bland
more pink and white (aryan) and less blank (nigger)
>>
>>101396394
You're the retard asking for help on a school project
>>
>>101396394
>someone's about to be kicked out of school
>>
>>101396388
You could

>take a plane from A to B
>drive by car (multiple routes available)
>drive by train

what's the distance then? it depends on the transport used
>>
>>101396377
It'll probably give you the distance for the shortest route...
>>
>>101386990
>#include <stdio.h>
should be
>#include <cstdio>

>typedef struct Meme Meme;
you can omit this line. this is only neccesary in C, C++ makes `struct` qualifiers redundant when declaring a variable of that type.
>>
File: gnome2_.png (12 KB, 285x279)
12 KB
12 KB PNG
>>101396394
Please, don't leave a comment if you have nothing to say.
>>
>>101394722
Angela Yus Web Dev bootcamp wont save you anon..............................
>>
>>101391255
Why not 'Matthew'?
>>
>>101394960
what a gorgeous english damsel, i envy the prince who swoons such a rose
>>
File: leeloo-2.png (1018 KB, 1119x742)
1018 KB
1018 KB PNG
i have carefully evaluated every post in this thread and have been left wanting. there appears to be very little daily programming going on.

have the moderators of this subreddit considered creating a "nightly programming thread"? perhaps this will receive more active participation. perhaps all the 'real' programming is happening at night?

thankyou for your consideration.
>>
>>101397158
>t. a vampire
>>
File: eri_beach.jpg (172 KB, 784x1145)
172 KB
172 KB JPG
>>101397214
Dude I am literally a vampire
>>
Extreme, potentially incoherent tl;dr: is there a name for a pattern where each function which might be modified by an observer returns a struct that describes whether and how it was mutated, and that struct is then used to decide whether to continue with the regular control flow or call new custom logic now embedded in the struct by observers? The key aim is to avoid turning everything into an object but to still be able to modify the steps of an already running function via the interference of observers.

Mother function calls modifiable subfunction.
Subfunction executes observer-independent logic, makes a struct, asks observers to modify it, and returns it to the mother function
Mother function checks the struct and either continues executing the default logic that is treated as the "child" of the subfunction or calls the custom logic the struct points to instead
Nest as needed
>>
>>101397462
>oop
yup it's inchorent, schizo slop alright
>>
>>101397483
structs are not objects :)
>>
>>101397462
you are doing a bad job of explaining it
>>
>>101397500
Unfortunate. Oh well.
Previous experience has taught me that if I write a three post epic nobody will read it, so I tried being brief.
>>
>>101397516
draw a picture
>>
>>101397493
the subject is an object and it returns objects called observers
>>
>>101397462
>muh function pointers but i am giving it funny names
this is like abstraction 101
>>
>>101397531
>>101397542
I don't see the issue?
https://en.wikipedia.org/wiki/Observer_pattern
>>
>>101397625
design patterns are pOOP slop
>>
>>101397625
I dont like the whole thing about algorithms, not once have i looked something up on the internet about LOGIC, are you not ashamed of yourself? Are you not ashamed of what someone would think of you if they saw you researching pre-packaged algorithms and thought you are some indian faggot who cant figure things out on his own?
>>
>>101397688
Nah. No use reinventing the wheel. Someone probably already thought of this and figured out the right way to do it, so I can just steal it and spend more time on novel problems.

That said, I think you believe this is about how to do something rather than about what's the cleanest and most maintainable way of doing it. As I work on more long-term projects I realize that the latter is the biggest hurdle more often than not. Habits that make sense at tens of thousands of lines of code will make you want to die once you hit hundreds of thousands.

Be kind to your future self: become an Indian faggot today!
>>
>>101397625
>Make issue
>Make pattern to solve made up issue
OOP is mental illness
>>
File: 1560312447857.png (16 KB, 274x301)
16 KB
16 KB PNG
>Small (700 LOC) repo I haven't touched for 5 years
>Someone opens an issue on it
>>
>>101398157
>make non-permissive license
>amazed when someone opens an issue instead of forking
as expected of a tranimeposter
>>
>>101398186
It's MIT.
It's also an incredibly niche program that is designed to test something very specific that only a very small handful of people might find useful. It sounds like they were just running it for fun.
>>
New bread when
>>
File: 1590404373519.png (285 KB, 302x626)
285 KB
285 KB PNG
today i've learned that most of the time the ideal way to write a file parser is not to try to unpack it into some in memory struct at all.
Its almost always faster and more efficient to just mmap the entire thing, as is on disk, and provide standalone accessor / sub-parsing functions that'll read the buffer directly and return pointers into the buffer for various things.

Like
size_t headers = ELF::GetNSectionHeaders(elfBuffer);
char* startOfSectionHeader = ELF::GetSectionHeader(elfBuffer, headers-1); //get last section header
uint32_t size = ELF::GetSectionHeaderSize(startOfSectionHeader); //handles endian converison here


instead of what i used to do, which was to define a whole "ELF" struct and "Section" struct and whatnot that i'd copy every value into during initial "parsing".
ELF elf = ParseElf(...);
elf.Sections.end().SizeField;


This is only more efficient if you are doing alot of specific processing, then you can optimize the memory layout for that, however most of the time you are not doing anything more than extracting some data, modifying some data, or writing some data, so unpacking the whole file into a custom in-memory-struct is actually a waste.

The advantage of this is also that memory will generally be more compacted and obviously it'll be continuous so its very cache-hit prone.
Thank you for listening.
>>
>>101398157
FIX IT, benchod
>>
>>101399181
>so unpacking the whole file into a custom in-memory-struct is actually a waste.
it is not a waste because until you access the memory it is not actually there
>>
>>101399206
is that some sort of mmap quirk or what? it doesn't load until you try to read the buffer? Then i'll just malloc the file.
>>
Seriously, just the change the font in gtk without getting a depreciation warning I have to create an entire css context and apply it.

Changing the font should be a single function call.
>>
>>101399217
Are you white?
If you post the back of you hand I will spoonfeed
>>
>>101399273
>be a useful toolkit? NO, write your own LOL
gtk is gnome software, just saying
>>
>>101399273
not a problem in my own gui toolkit which is just a function call
>>
File: file.png (1.6 MB, 866x1300)
1.6 MB
1.6 MB PNG
>>101399299
>Are you white?
yes

what the fuck else do you mean? Yes the memory is there if mmap or malloc it?
>>
>>101399318
i cant masturbate to that D:

Anyway, you sound niggerish so i will just say that in kerneldev we can do magic things
>>
>>101399354
>MADV_WILLNEED
>>
>>101399354
>mlock()
>>
>>101399305
>>101399315
I can't create an entire toolkit by myself. I lack the skill and ambition.
>>
>>101399407
not it. and you wont bait into an explanation.
>>
>>101399448
it is just drawing circles and lines bruh
>.t gave up because wayland
but the functions for the pixelmap were there :shrug:
>>
>>101399558
yes it is, with mlock, you're just retarded.
>>
I recently made a script for org-roam that auto-downloads just the subtitle files from youtube for any video that I have captured, then calls org-recoll on it, then feeds it into helm-recoll to suggest videos about content that I am currently writing on but might have forgotten already
>>
>>101399206
>it is not a waste because until you access the memory it is not actually there
and how do you think the unpacking process works anon?
>>
>>101399570
nope, still not wasting memory on a call to mmap.
You dont know what vas even is.
>>
>>101399619
>unpacking process
the what?
>>
>>101399689
thanks for showing you dont even know what we're talking about. I accept your defeat.
>>
>>101399684
i know what virtual address space is, you seem to not know that you can prefetch & lock pages
>>
peak internet moment
>>
>>101399742
people like you deserve everything bad that happens to you
>>
File: file.png (1.09 MB, 700x933)
1.09 MB
1.09 MB PNG
>>
https://github.com/microsoft/STL/blob/main/stl/inc/semaphore#L48-L49
You will not heckin wait more than 10 days chud
>>
>>101399217
>is that some sort of mmap quirk or what?
I concur, you sound brown.
>>
>>101397462
Mother steps her Mealy machines.
>>
File: sicp snake.png (131 KB, 2000x1500)
131 KB
131 KB PNG
Read SICP. I am no longer asking.
>>
>>101400955
I don't read utter garbage made by complete subhumans who should've been executed Cheka-style before they were even born.
>>
>>101400967
Such as your own posts?
>>
>no u
No, more like yours.
>>
File: semicolor_4c.webm (1.49 MB, 1920x1200)
1.49 MB
1.49 MB WEBM
Made a color picker in a few lines of pyside6
(I only added 2 buttons at the bottom of the qt color dialog)
>>
>>101400955
Disregarding what that other retard said.
Honestly Lisp is outdated and has no use in the real world. Besides, SICP is too math heavy and too hard. Let's be real.
>hurr you're too retarded for it
Yeah maybe but we retards have a right for stuff to be accessible
>>
Why is Go so fucking idiomatic?
Doing, for example:
value, ok := my_map["test"]

Or whatever it is to check if a map contains a value, feels and reads so damn weird, or am I just a stupid junior?
>>
>>101401793
>am I just a stupid junior
That. Inband signalling is dumb.
>>
>>101401793
I much prefer to get back an option<value> in theses cases. I wish go had options, hell I'd even take explicitly nullable values though I already like them less
>>
I use Python a lot for my job (data science) but sometimes I read Python code and I don't really get what's going on. I guess data science ony requires basic shit like control flow, functions and some OOP, but I have no idea how to use more advanced concepts like decorators, currying, yields or whatever. I feel like my grasp on the language remains basic.
Should I just read the docs to learn more syntax?
>>
New thread:
>>101403054
>>101403054
>>101403054
>>
>>101402979
>I have no idea how to use more advanced concepts like decorators, currying, yields
Ask chatgpt to explain those. One by one
>>
>>101397462
>struct that describes whether and how it was mutated
https://en.wikipedia.org/wiki/State_pattern

>that struct is then used to decide whether to continue with the regular control flow or call new custom logic now embedded in the struct
https://en.wikipedia.org/wiki/Decorator_pattern

>>101397483
unironically going all out with OOP for this would make this shorter and easier to manage than trying purely procedural



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.