What are you working on, /g/?
Previous thread:
>>105889001
No 'threadly reminders' for this thread.
(If any are posted, they're fake and should be disregarded)
>>105929512Rolling by here
>>105929512For me it's the umaru disinfo thread
For me it's C and TCL/TK.
The difference between n and n^2 is brutal.
>>105930408uh actually it's |n^2 - n|
How the fuck does unmove work
Is it ever going to give you a dead ref to temp
>>105930910why don't you disable the intro while changing it
>>105930950I put it back for the video for gorgeous looks.
in c, if you have an arbitrary sized object with and equal amount of declared elements, say a struct with some amount of allocated but memory. if you set that struct equal to zero, what exactly gets set to zero in memory?
e.g.
struct something *n = (something *)malloc(sizeof(something));
*n=0;
>>105931189or would this just be the first size(int) bytes at the location of this struct.
>>105931189>>105931274this is unlikely to compile unless C is more retarded than i thought
>>105931274I don't see how this could compile. you're attempting to assign incompatible types
>>105931189That wont compile. If you want to zero out the struct (or at least its fields):
*n = (struct something){ 0 };
And you can swap out the zero for actual fields and the rest will be zeroed out.
gentlemen, I do believe we officially have a viable software rendering engine
>>105931623what a lovely day!
working on a FOSS personal goal dashboard for linux with python. might also do for android
>>105929300 (OP)Kiseff please hire me.
>>105930910I admire the raw dawgging of 3d graphics and VS here anon
I have a MQ that uses SQLite. There's a flush routine that runs every 100ms. I just recently found a rare bug because the file isn't locked when flushing the queue table. Will adding a lock fuck up the write/read flow?
>>105930111Based. I use odin and jimtcl
ps
md5: b2c70680964f0bf15e50b41343bb2a78
๐
continued to work on my postscript parser after leaving it to rot for a year or so, it can now properly parse digits.
frfr
md5: ec770cb3c3f06e30e5903088b3427daa
๐
If you're one of those people that actually got a team to use rebase workflow in git I hope you choke on your own farts.
>>105929300 (OP)Are there any FOSS debuggers available for linux systems other that gdb? specifically for C / C++ in my case
How do I force myself to program instead of watch tiktok whores with small waists and large busts all day? Fuckk I hate programming but there are no jobs that are both cozy and actually pay well.
>>105936096You gotta up your goon game so that you're busting so hard that you dont even wanna look at a bitch for at least 12 hours.
>>105936096Make a compiler.
>>105935981Pressing the debug button in vscode works for me.
>>105936096Learn to multitask and do them at the same time I guess?
>>105936096Knock several of them up
in C++ what would be the right type of container to use for a list of objects that various threads need to be able to add / remove / operate on / hold a reference too (not necessarily a literal reference)?
>>105931623Let's fucking go brother
No meme here. How do I understand rust in depth especially around the compile time safety guarantees and its flaws of the borrow checker?
>>105935306They all ganged up on me and just use merge after merge causing huge bloat in git history
>>105935981The LLVM/clang one
>>105936096Build your own raft consensus backed, distributed, fault tolersnt sql dialect database.
Anyone know why my college is forcing me to write notes on what I will be doing for my project for the day before actually doing it? Do these retards actually think anyone works like this when it comes to programming? Usually I start programming and see where it takes me, I can make a lot of progress in one day or make very little in one day, and face different challenges of course. This is so fucking retarded but I'm forced to do it on a weekly basis for some reason and waste a bunch of time instead of actually just going straight in to program.
>>105940256So they can sell it to some machine learning company or use it to experiment with having AI do the same thing
>>105940256real programmers don't write notes but instead have daily stand-up meetings where they tell (by actually speaking) the rest of the team what they're working on
also your tasks are pre-planned for the next one to four weeks
"just start and see where it takes me" is pure unemployable hobbyist approach. no one will stop you, but no one will employ you either
>>105940595Except they're told what to work on, you don't just decide what to work on by yourself, you mongoloid. And then most of the time you're given a reasonable time limit from your supervisior and often times people get it done and don't have to do anything until their boss gives them a new task. I on the other hand am doing a project all by myself, I could complete it in a week or in a month depending on how experienced I am.
>>105940595stand ups are for bootcampers and JS monkeys, real programmers figure out what needs doing and disappear to get it done
>>105940711>a projectyou will never finish it
>>105940716>>105940711t. unemployed hobbyists
>Except they're told what to work on, you don't just decide what to work on by yourself"The Business" states what they need done, the developer decides what to work on (aligned with the business' priorities if possible)
>And then most of the time you're given a reasonable time limit from your supervisiorThe developers are responsible for estimating tasks
>and often times people get it done and don't have to do anything until their boss gives them a new taskMaybe if you're some unimportant throwaway intern and not an real developer with any credibility or accountability
>>105941697>The developers are responsible for estimating taskslol
>we need X>takes 3 months, boss>make it 1>rush it>release half assed shit>client complains>in the end it takes 6 months and we are all happy it's over
>>105942236your silly little scenario doesn't reflect how it works in reality
>>105942385It literally does if you have incompetent middle management (or upper management, for really small companies)
me
md5: 62c91f964112eacb446321ab7cafdf34
๐
>>105942406find a better job than this imaginary one
also you're blaming management for not stepping up to what should be your competence and responsibility
>>105929300 (OP)Are all characters always 1 byte in size?
I've been working on a C++ library which has a focus on always allowing an allocator to be specified for every container or function which may require allocation. Allocation is always fallible, and in general I try to avoid interfaces where "if you do X, it's UB," to a degree that I feel is reasonable. I also have decided to make my own IO interfaces, and I implemented strings and IO with char8_t. Having done that, I think char8_t is a huge waste of time and I may as well have used plain char and dealt with the pain of determining the sign of char on each platform as applicable and doing whatever casting is necessary for handling UTF-8 encodings with it. char8_t is a total pain in the ass.
>>105943105No, Windows and some embedded platforms don't do that. Wide character types in C and C++ are a huge pain in the ass.
https://streamable.com/a9ovud car select works
>write 1000 word essay on why use Rust
>I have never written a line of Rust in my life
https://mnvr.in/rust
LMAOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
>>105944443based
im not reading your blog though
>been using visual assist for many years
>update visual studio
>visual assist constantly makes annoying error popup
Apparently I need to update visual assist to fix the issue, but I don't feel like paying $129 for that. Coming to think of it the only feature I'll really miss is the file browser (pic related).
Does anyone know of another add on that provides something similar?
>>105944865code one yourself?
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/#mailing2025-07
kitaa
>>105944872>code one yourself?Tempting, but I don't have time for that unfortunately. For now I guess I'll just go back to an earlier version of visual studio.
>>105944953continued
Just told chatgpt to make an add on that does this. Works pretty good with some tweaks. Really not that much code, but I suppose the devil is in the details. Never used C# before so maybe it's total shit.
guys Iโm gonna take a class on swift at a local college. I have no programming experience, havenโt taken math classes in over a decade, zilch, pretend Iโm retarded, but it only takes one semester to complete all its courses. I donโt think itโs particularly in depth, but since itโs enough to get a certificate out of, how should I set my expectations on my ability as a swift programmer at the end of this, assuming I finish? Could I really build a whole app from scratch? Perhaps a barebones note taking app, or an app that has syncing or data crunching functionality?
I would be doing it for fun so my personal expectation is I can make my own freeware apps, because once in a while I browse the App Store for certain apps and it annoys me how many bloated paid apps there are, that I wish โI could make my own app specifically for me with these certain functionalitiesโ
>>105944443Damn balding at 20? Jeetcel.
>>105947384is it because itโs apple only?
>wagies yap at me about OOP being about big teams
>the actual history is a bunch of boomers fumbling around with optimizing code-reuse in their lone-wolf projects
>>105947295Swift is irrelevant outside of fruit platforms so be aware of that.
The best (ie, easiest) language for general phoneslop is Kotlin or Java.
>>105947609>we spend too much time coding and maintaining it, we need to reuse codeMaybe write pure functions?
>inserts logic in SQL stored proceduresMaybe write pure functions?
>inserts logic in table rows and dynamically crafts SQL statements to be run in stored proceduresMaybe write pure functions?
>makes a 5 depth inheritance chain where you have no fucking clue which one of the commit() gets run when you see a TransactionMaybe write pure functions?
>we are using a static typed language, why do we have so many bugs?>imports obsolete Java 1.4 library for some stupid diagrams
>>105947501Not anymore, they had a big push for going crossplatform
Personally, I like the language because it has ARC and pattern matching with algebraic data types, but I ran into issues when I was trying to use it for writing utilities.
I think it's good for backend webdev with a framework and macOS/iOS app development. I still find myself using Nim or C# more for my usecase.
Currently thinking how I'm going to architect a rule checking engine that checks values fetched from an external API using custom rules and check functions from plugins
The part I'm having trouble with is how I can put a function pointer into a C# class, but I think Func<T> is going to do the trick
This was really easy to implement in Lua since I can put functions in tables and return that. Unsure what the C# equivalent is.
I've never written a single line. I am going to learn Rust as my first programming language
ptsd
md5: bdb57e2228ad5cafad007a99cf2218fd
๐
>>105948428good fucking luck
So if I want to compile some dependency I have 0 control over with a specific GNU libc version in mind my 3 options are
>compile on an old version of debian in a VM
>the same but docker
>forget glibc and do it with musl instead
Is there really no convenient option like .symver?
i'm writing a grpc api, not sure whether i should bother with compression yet and what standard to go with
i think lz4 is probably the best for me. i know grpc is already pretty efficient.
>>105930910are you writing your own physics engine? Good any good resource on that?
>>105950269I'm decompiling an existing game. It does have its own bespoke physics engine, software rendering engine too.
>>105948012I was right and now I have a working implementation that dynamically loads from other assemblies too
>>105931504MISRA Rule 10 violation
>>105931623Great job anon, and very nice looking implementation there. Are you using Pineda's algorithm for triangle rasterization?
>Waste 2hs of my life trying to find out out why Cursive doesn't want to recognize my extremely simple Clojure project
>Make it work by removing all the autogenerated config crap then running three miserable commands by hand
Not sure if i'm retarded, or IntelliJ is retarded. Either way, Clojure is a lot less unpleasant to run through the CLI than Java. Simple text editor it is.
I want to fork fortune and keep all the offensive jokes in an add even worse ones but I can't find the original program or list.
I mainly want the original list written by Ken Arnold in the 1970s.
>>105952652No idea lol, whatever they did in 1995. Could ask an LLM I suppose.
>>105949494ty-- I will need a lot of it
>>105950850>I'm decompiling an existing gameare you doing it manually by looking at the disassembly or are you using a decompiler and manually fixing what it produce?
>>105943105If by character you mean characters in the alphabet and not the datatype char then they vary in length for all platforms when using utf.
>>105953733I don't know about the original but here's what I found
those don't have much
https://www.tuhs.org/cgi-bin/utree.pl?file=V7/usr/games/lib/fortunes
https://www.tuhs.org/cgi-bin/utree.pl?file=V8/usr/games/lib/fortunes
but here's the good stuff:
https://www.ibiblio.org/pub/linux/games/amusements/fortune/fortune-mod-9708.tar.gz
https://www.ibiblio.org/pub/linux/games/amusements/fortune/kfortune-1.3.tar.gz
Working on my website csbook.club.
https://csbook.club/off-topic
I found database dump of all /prog/ posts from 2008-2014, which I'm working towards importing them into the site. A few changes need made beforehand though to support it.
>>105955285also here
https://github.com/shlomif/fortune-mod/tree/master/fortune-mod/datfiles/off/unrotated
Am I the only one who think that std::expected wasn't that necessary? Like std::tuple, std::variant or std::pair can do the work just fine in case you wanted something similar to result
>>105955851std::* is slop and nobody intelligent uses any of it
>>105955861Is it? I have no time to reinvent everything for my hobby game engine just for 0.1% performance improvement, no sure why you guys hate exceptions and safety
is using ai to get a better understanding on how shit works frowned upon? Genuinely wondering because on one hand yeah, there's that small chance it may be inaccurate but on the other i really dont feel like going on a forum just to ask retarded question nr. 49
Hello kind sir. Supposedly wine's "new wow64" can run 32-bit programs on 64-bit only systems.
would it be feasible to LoadLibrary() a 32-bit DLL and invoke its functions from a 64-bit winelib program?
>>105954532Both. When I first started I was just looking at the asm (with debug symbols). I tried Ghidra briefly but it's kinda junk for DOS stuff. I managed to figure out their resource mangling algorithm and how all the graphics resources and track files worked using just the asm and a lot of trial and error plus some help from other less technical fans of the game. Also had a beta version of the game where the resources were not mangled. Wrote a pretty good track editor and resource converter that way: https://github.com/Zizin13/RollerTrackEditor
Now I am using IDA which has a decompiler specifically for Watcom, the compiler they used to make the game. I have gotten pretty good at using it and am making very good progress. I think I will have the entire thing decompiled in a few months. https://github.com/Zizin13/ROLLER
Finding a released exe where the debug symbols were not stripped is what made it all seem possible.
>>105956410If the LLM is doing the thinking for you or you can't verify what it says, then you are using it wrong.
making web page for my project with Sphinx. it's pretty good.
>>105955861>filtered by stdlibgrim
>>105958250nope, its moreso me asking it "hey, so i dont have a single clue how a range-based loop works in c++, could you explain to me in detail how it works, provide examples as well as sources and documentation for your claims?", I'd never use it to do something for me, it's more so like walking rehabilitation (getting help till I git gud in walking) instead of a crutch (needed for walking)
>>105958627That's fine.
You can also include extra context (e.g. I'm writing a compiler, I know C, &c).
>>105958665Oh yeah that's also a good idea, Ill keep that in mind, thanks
>>105956877are you also reverse engineering the algorithms and whatnot or just translating the code?
>>105949796I think there's probably a better way if you can install and link against an older version of glibc. E.g. if you compile with --sysroot and point it at a directory with an older libc.so it should correctly pull older symbol versions.
>>105932704The SQLite library handles all locks on the database for you. Work instead with the higher level concept of transactions, and remember that the DB will start a separate transaction for each statement if you don't do so manually.
Most of the time you don't need to do anything special, except when dealing with writes after reads in the one transaction, because two threads (or processes) upgrading transaction type at once is a deadlock risk and SQLite uses very coarse locking.
>>105959002A little bit of both. Some things could be pasted in directly from Ida and worked fine with minimal fixup, others I had to figure out. A lot of times when the compiler optimized loops it referenced adjacent pieces of data with an offset. Especially if referencing multiple pieces of data and it wanted to increment the same value for all of them. I have to fix this because I cannot guarantee identical data layout. Annoying but not too difficult.
Texture rendering I had to figure out too because they wrote a heavily optimized algorithm that did crazy pointer math on 64-bit values (4 16 bit DOS memory selectors) to draw up to 4 pixels at once. This won't work in modern x64 compilers where pointers are 64 bits themselves of course. Fortunately they had another slower (and simpler) algorithm that looks at each pixel individually so they can handle transparent pixels if the texture tile has any that I was able to re-write and adapt to modern pointers. I just made the optimized function call my adapted slower version too lol. I preserved the 16.16 fixed point math so it looks exactly the same with the textures kind of walking/shifting around like a Playstation 1. Same Z fighting issues of the original game too.
>>105955285>>105955368Thanks anon.
I will post what I come up when I have something to show so ni/g/g/ers can tear it apart or contribute.
>>105955887exceptions are fine if you use your own exceptions and avoid all 3rd party exceptions (from libraries and std).
the problem with exceptions is that you now need to be consider noexcept, if you didn't use exceptions you can just disable exceptions and not worry about it (chances are it's a 0% fps difference, but because you can't disable exceptions, you can't benchmark it).
There are a few compatibility issues with exceptions, such as emscripten (running your game on the web with webgl) won't work with exceptions ATM without huge performance issues (but I think there is a proposal for exceptions to be part of wasm).
The best way of using exceptions is to avoid using them for user error (don't throw exceptions that are the user's fault, because that's a normal part of execution, such as like entering a bad number into a text prompt, or a handled "not found" error because the error happens inside a construct, because if you had a handled exception that you want to find the location of, you would need to learn how to filter a exception to only catch a specific exception instead of a frequently raise generic user exception, BUT if you wrote your own exceptions, you could add a stacktrace to the exception so that you would know the location on your debug build).
And in theory if you follow the rule of avoiding exceptions for ALL user errors, exceptions should be very very very rare, and you could in theory just disable exceptions with a macro (for the purpose of emscripten or benchmark for example). And it would work perfectly, until a non-user error happens such as... erm... I don't have any good examples, std::out of range or deadlock / etc, shouldn't be caught (just let your debugger catch it), I question what is a good exception to catch? If a file is not found / invalid UTF8 happens, you shouldn't throw an exception, that's kind of a user error.
It just feels like laziness caused by the fact you can't return an error from a constructor.
What exactly is the point of this tranny rewrite when the original fortune does this by default?
I swear rust trannies just invent problems to scrape for relevance.
>>105960785a great example of why you only design a new public language to solve a real problem.
>>105960777holy... I didn't know std::vector will just ignore your move overload if you forget to add noexcept. Back to C++03's free+malloc for every element on reallocation just because you forgot to add noexcept...
And this could be intentional, would you get a warning from any linters, like PVS-studio for this?
>>105960785The rewrite is also subject to historicity as future contentions are unknown to us, leaving only the inverse of retroactive revisionism (time travel)
Chatgpt was dropping the ball pretty hard on this so I had to write most of it myself. Very annoying but at least now my CMakeLists.txt looks nicer.
>ask ChatGPT to write a small program that changes the hash of jpg and png files
>compile it expecting a trillion errors
>not only it compiles without errors but it works
Color me impressed, if I had asked the same thing to an AI two years ago, it would have given me code that barely made sense, let alone compile.
Of course, it's super bare bones. I want to add a bunch of things, but it saved me so much time writing a prototype. Also, I would still not trust AI to touch any codebase that's remotely complex.
>>105962783Ok, I take back what I said. That only works when running the program for the first time because it uses a different compression algorithm than the original image. Running the program on the same image twice will yield the exact same hash, which is wrong. Oh well, it was an improvement at least.
>>105962783As far as png goes, you can append a zero width ancillary chunk (constant bytes) after IDAT header (constant offset)
JPG is a bit tricky, but maybe image viewers/editors don't care what comes after FFD9 if it is at the end of the file? I just tried and it works on my machine.
Unless you explicitly want to change the image pixels, it's pretty easy.
>>105964533>IDATmeant IHDR
>>105964533Some hash checks like 4chan's, ignore metadata and trailing trash at the end of files. The actual core of the file needs to change. And flipping random bits can sometimes corrupt the files.
Anyway, I fixed the issue with the hash not changing after multiple runs by using std::random_device and std::mt19937 instead of std::rand.
>>105964632Oh, I don't think 4chan edits png images in any way.
If you worry about being tracked via archives, your approach is fine for most archives since I haven't seen one using phash.
Copyright wise, I don't think that works.
Many many years ago I recall 4chin detecting the image I was trying to upload even after hitting random pixels and I wouldn't recommend going out of your way to harm poor hiroshimoot.
Also, I would recommend simply extending 4chanx to automatically do that instead of relying on your memory to change the hash before posting.
>>105964711Yeah, it's basically for the archives. I'm not trying to bypass 'blacklisted' images. I'm aware that blacklisted images can be detected even if you drastically and visibly change the image. Maybe Hiro is using AI or an advanced algorithm to filter such uploads, I'm not sure how they're doing it.
>>105964632you could probably have seeded rand with random device
>>105960000That one sound promising. --sysroot to the older libc but keep -isysroot pointing at /usr/include and then see if I can tard wrangle whatever build system these unruly dependencies are using.
>removed one if branch
i love premature optimization
n = n*85 + c - '!';
n &= -(i%5>0);
I'm surprised how easy it was to add an entry to the context menu in the file explorer on Linux. At least on Nemo, you just need to create a .nemo_action file at ~/.local/share/nemo/actions/ and fill it with basic info such as the executable path, label, icon, file extensions, etc.
I thought it was going to be a pain in the ass like on Windows, where you have to mess with the registry, and if you want to handle that shit via code, you'd most likely need a specific library for it.
>>105965646>-(bool)in what situation is this a useful mask? is it to remove the lsb?
>>105965710i%5>0 evaluates to 1 or 0 (for multiples of 5)
-1 is 0xffffffff
so this expression will evaluate to either n&0xffffffff (n is unchanged) or n&0 (n is set to 0)
>>105965758o you are right
smart frogposter
why not multiply by the bool though
>>105965861>why not multiply by the bool thoughi could be wrong but i think bitwise operations are faster than arithmetic. Ofcourse this solution requires a bitwise and, and the '-' operator vs just a multiplication so im not sure maybe it is slower..
>>105965956i would assume the compiler could change one into the other if it is faster but maybe not
according to amd imul has a latency of 3 cycles and throughput of 1/3
Doing some osdev. Wasted several hours last night figuring out why paging wasn't working, was because I OR'ed cr0 with 0x80000000 instead of 0x800000000. Works now though. So far have:
>printf with int, uint, hex, char, and string handling
>terminal scrolling
>keyboard interrupts
>paging
Gonna whip up a basic kmalloc next.
I have C++ code for microcontroller that reads serial commands and executes them. Right now I'm using very long switch case for the command execution, but for some more complex serial commands I have to nest another switch case. Is there some conventional tricks to optimize nested switch cases?
>>105966614You could have all the complex commands set certain bits, so you could check for those beforehand and have several flat switch cases rather than single nested one.
>>105966614If the compiler is halfway decent that's all just going to get optimized out anyway.
>>105966614what's wrong with a few commands having a switch case?
>>105966614nested switches are fine and very typical in control systems written in C. you'll see shit like
switch(primary_state) {
case pstate1:
switch(secondary_state) {
case sstate1:
case sstate2:
case sstate3:
}
case pstate2:
case pstate3:
case pstate4:
}
if the content of the second level is too unrelated or getting to nested you can always break it out into a separate function, whether that makes it more readable depends on use case
>>105968462pstate1_sstate1
pstate1_sstate2
...
you can do it with bit twiddling too
Do I need to install microsoft visual studio just to use msvc with clion?
>>105968826>do i need msvc to use msvc
>>105968826oh sweet summer child, you thought you could compile without a microsoft account?
>>105956877Very nice anon. This is about what I'd expected, that the big monolithic do-it-all decompilers are too broken and that you'd have to figure out some stuff directly from the disassembly.
Your track editor looks really sweet btw, judging by the screenshots.
There is also a pc video game I'm dying to RE but I'm not ready yet and it's going to be a mountain of work.
>>105968969Where's the link to it? I couldn't find it.
>>105968969>>105969063Is it only available in an online installer?
>>105929300 (OP)Added text wrapping to my CLI client. Haven't visited this site since the AI boom, but felt like doing this.
God bless you all.
>>105969642how do you view images?
>>105969665I usually don't care about images. To be honest, I don't care much about this site anymore, I just remembered about this project and wanted to improve it.
I do have a shortcut for opening links of my terminal in a browser, if I am really curious. Most modern terminals (i.e. that use electron) have this, but I had to get a bit more creative to fit my taste in ST.
>>105968999Yeh even Ida barfed on some things like the huge textured polygon rendering functions and it even completely skipped a jump table on one (fortunately pretty simple) function for some reason.
https://youtu.be/Pa36B1T__ng?t=686
>AI can already generate code faster and better than humans
Do you guys think I'll get flagged with this or am I safe?
>>105969930>deletes all company files
>>105969930Use a Poisson instead for extra realism.
>>105969930why not just play some vidya instead
>>105970606This is a macro for vidya, just wondering if it could get flagged by anti-macro systems.
I doubt they have system that good, but just to be sure I wanted to know if 60-100ms long click and 100-200ms delay between each clicks is enough to seem human
>>105970852you should record your inputs while playing, plot the data and do stats
>>105969913just don't let it touch prod
>>105962669
>>105970852>just wondering if it could get flagged by anti-macro systemstheoretically yes, practically probably no
they're mostly keener on going after people who abuse the cash shop in many games, and non-aimbot-assisted macros are low on their list of targets, especially as they don't necessarily help very much
if you are worried, do simple binomial delays by adding three uniform random numbers together and sleeping for that much
>>105966016When you can draw bitmaps please port satania-buddy to your os
Porting Satanichia-chan to MacOS!
Hello anons
I'd like to implement a plain-text file config for my current project, in C++. How should I approach parsing? I'm thinking about reading the file line by line, then storing these into a string array/vector, for further processing (e.g. substring search). But I'm mostly certain that it is not very practical. Any input is appreciated!
>>105971682LALR parser generator or regex or key-value pairs and a separator or JSON/XML and a parser made by someone else.
These are your options.
>>105971682Just use JSON or Yaml.
>>105971682while(fscanf(file, "%s = %d\n", keys[key++], values[value++]))
>>105971682I just use a basic struct + vector + fstream all wrapping in a "Settings" class. Super simple, but just works for storing stuff like program X/ coordinates, window state, etc.
What is the true barrier to being "good" at programming? Hard limit IQ? Math ability? Rote memorization of esoteric CS topics?
>>105972275Not asking retarded questions in forums instead of programming.
Fucking FINALLY found a decent library to do graphics in Python. Decent modern-style API with a lot of QoL features. Platform independent too.
>>105972533>Constructing a hash table and passing it with render settings for each frame
ogey
md5: 280357550283c21752025dfbcae5c0cd
๐
>>105971720>>105971936>>105972144>>105972163Alright anons, lots of starting points. Thanks, I'll check each one!
Suppose I have a class that allocates memory dynamically. I want to implement an assignment operator, but before I can do that, the class object that I want to write to must be cleared. Is it okay if I call the destructor within the operator function?
>>105972275>Rote memorization of esoteric CS topics?Rote memorize until the isomorphisms between topics are known, then forget everything
Lads, I'm thinking of editing the source code of xdg-desktop-portal to customize the GTK's file picker. How much of a bad idea is that?
>>105970852Use a standard normal distribution, not an uniform distribution.
What C/C++ library should I use to read pixels that are on the screen? (windows/linux)
>>105973168>negative sleep
>>105973182open("/dev/fb0")
>>105973182YOU CANNOT DO THAT IT IS UNSECURE
MUH WAYLAND AAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Saw this in a random video
Do vim users really need macros and find-replace just to rename a function or variable?
In visual studio itโs just ctrl-r,r and it safely renames everything everywhere, even fixes filenames and namespaces
file
md5: 00f70c6ff938219707ef4ca5db618fd8
๐
Is this bad practice..?
>>105974719The practice is fine
Manually checking for 0 is probably faster but unless this runs 1000 times per second it doesnt matter
If 0 being there is unexpected then the error should be logged somehow, but thatโs for prosuction code
(And dividing by 0 should give inf not 0)
>>105965646Just use a ternary to infer cmov
file
md5: f952458aa09aeddda85947e38a0dfc86
๐
Two years ago, I started working on a lottery number generator that used quantum number generation. Back then, I had finished it pretty quickly but it was hacky and there were problems that got in the way of true randomness like the largest integer with 7 bits being 127, and I was adding min value to the generated integer which basically in effect shifted the generated integer to +1. And there were many other problems to it, and the program was crude.
But now I decided to work on it some more after along hiatus and I've finally achieved true quantum randomness to lottery number generation.
I want to get a better understanding of pointers and memory management. I still feel so retarded looking at this stuff.
Like yes, I understand that pointers just point to a spot in memory. I understand you can use these pointers to pass arguments by reference and thus manipulate the original data that is being pointed to. I still feel like theres a lot more I don't get.
>>105972144>keys[key++], values[value++]>not setting key = keys, value = values
>>105974719you should annotate it using paramspec, and also have a default positional argument to replace 0, e.g. with None or a bespoke constant
>>105975274>I still feel like theres a lot more I don't get.there's not unless you mean C autism that doesn't apply to real compilers on mainstream hardware (provenance)
you should make sure you understand alignment and pointer tagging though
>>105975274>>105975424i mean there is more to memory management like understanding virtual memory, paging and so on, caching, different systems of memory management (like the autist who never shuts up about arenas)
I am more than decent in Python and started learning C# just for fun I guess and it immediately feels like home. I know its a substandard microshit language but there is an incredibly satisfying feeling of OOP clicking together, coming from Python where it's implemented in a retarded fucking way.
What language does /g/ recommend if I actually liked C#? (I dont like that its so closely tied to Microshit)
>>105975442>like understanding virtual memory, paging and so on, cachingThis kind of stuff is usually handled by the OS, my niggy. Unless you're writing a fairly complex program, you typically don't need to worry too much about memory management, even in C/C++. And by the time you're working on something that requires that level of control, you'll likely have developed a natural understanding of how it works.
>>105975424This is something I both love and hate about programming.
I have never even heard of either of those terms. Maybe its a consequence of being entirely self-taught. While its cool that I feel like theres always something new to learn, I never understand when I'm missing some kind of critical information that will lead to my suffering and thats made me very unconfident in my abilities and thus has made me program less and it becomes a vicious cycle.
I don't know what to do besides stop being a coward and actually taking time to write code despite knowing it'l probably be bad and there are tons of abstract concepts that I don't understand
>>105975487this is just bait written by you, the memory autist, so that you, the memory autist can reply to it about how important it is for performance
>>105975505alignment isnt abstract, its just the idea that sometimes you expect pointers to not be every byte, but every 2 bytes or so on (like even byte addresses), or every, 4, 8, etc
pointer tagging relates to this but also the idea that you don't really need 2^64 bytes (64 for 64 bit address on a 64 bit pc) on consumer hardware currently, so you can use bitwise operations to pack and unpack the real pointer along with extra data in those bits you won't use
>>105975467Java?
>>105975274 Virtual memory, caching, prefetching and access patterns, alignment and packing, non-temporal access, atomics and atomic memory ordering, false sharing and cache coherence
Just read this honestly https://people.freebsd.org/~lstewart/articles/cpumemory.pdf
>>105975542i guess its not literally 'abstract' but I never learned anything to do with data sizes and bytes other than the basic information about 8 bits being a byte and various data type sizes like a char being 1 byte and a long being 8. I have barely scratched the surface of bitwise operations.
Theres just so much to learn and so many unknowns that I never think of.
Memory autist, you're putting the cart before the horse.
First, write a few useful programs, then start worrying about all this crap.
what did the silicon valley tranny mean by this?
>>105976182Looks like straight facts to me
>>105975595My college course had very high level math courses, and low level C and operating system courses and we still didnโt learn much about bitwise operations besides xor forming an algebra or whatever
You can learn everything about them in five minutes if you really want to
And data sizes differ between languages so you canโt universally learn about them.
>>105976253>popen bad because muh cafes and typewriters
>>105976438more like poopen lmao
What do the Cursor devs have against Grok?
Fuckers should just build it in by now, everyone is using it already anyway.
>>105930910kino, was wondering where i recognized the splash before whiplash showed up
>>105935306explain why it's wrong
we do trunk based development with release branches
hate git, wish we had stayed with svn
>>105938643Whatever works based on the insertion/removal logic you need
Hand out shared pointers or weak pointers to handle reallocation or deletion
Made my ick editor support multi-line selection. Thoughts?
>>105976182>seethes at the idea of old white men programming in C 50 years ago>deconstructs their work and kick them while their down>but pretends it's an in-group joke that only enlightened devs can understand in order to hide his slyness and pettiness
Still working on the primes, bit more complicated than I thought. Actually I switched to doing some basic ascii text generation
in gdb is it possible to break when the progam executes a particular binary file?
I know I can do "catch exec", but I don't know how to check the filename and continue if it doesn't match.
>>105977813is it available on steam deck?
>>105977813How about multi-line rotate where you can swap multi-line blocks for b=2 and shift/rotate b>2 blocks, e.g. with multi-line selections on x, y, z in f(x, y, z) a single rotation produces f(z, x, y), it would be useful for swapping if-else blocks around
>>105978129You can apparently use conditional breakpoints like
(gdb) break f() if strcmp($name, "/bin/ls") == 0
not sure the exact syntax
chad
md5: 866c2208ed2e7a7e7db68efabddbe651
๐
$ git commit
Aborting commit due to empty commit message.
$ git commit -m .
[master (root-commit) ca7692f] .
1 file changed, 245 insertions(+), 0 deletions(-)
>>105974788you lost me at ternary
>>105978352https://kristerw.github.io/2022/05/24/branchless/
I didn't even know autobranchless was an optimization step
Haskell sweeping all state under the rug only to keep the "pure FP" label is fucking stupid.
If I myself need so many minutes to understand the State or IO monads, imagine a normal programmer.
If things are so complex to begin with they should never be used in production. Ever. In itself complexity is a legit reason to dump a technology. What use is code that only a few can understand? Production code should be workable even by people who come from other languages.
If mutation is so badly needed, maybe you should just build it into the language, instead of resorting to obscure ways of keeping the functions pure while looking procedural?
Fuck Haskell and fuck pure FP. It was never the solution to anything.
>>105929512why are half of these fizzbuzz or two sum or babby tier "hello world" shit
>>105978449It's a problem even with mutability, as an expression like f(x) + g(x) + x can't be freely reordered by the compiler when it's unknown if f or g have side effects. Ideally the most expensive calls are done first to reduce later register pressure
>>105978224but how do I get the name of the executable?
And how do I do that with an expression?
I don't know how to put the result of gdb commands into the conditional, so I can't use ANY of the gdb commands to get the name...
>>105978449>If I myself need so many minutes to understand the State or IO monads, imagine a normal programmer.what kind of programmer are you, HUH?
You think you're better than me, don't you?
Tell me then, what makes you so special?
>>105978864If the program name is unknown the first argument to exec should be in $rdi on x86-64, I believe you'll need this information first before being able to check invocations of exec for specific programs like you wrote in
>>105978129 (you could use gdb regexes if some part of the program name is known, or just use strace and grep)
>>105931623now THAT is zesty
Good work, I love seeing this mega comfy accomplishment. Any plans to celebrate?
>>105978449>If I myself need so many minutes to understand the State or IO monads, imagine a normal programmer.This is called LEARNING
Once you have LEARNED it seems really simple
>>105978449what part of
Monad m => m a -> (a -> m b) -> m b
do you not understand
>>105978864>gdbAmazing how Linux still doesn't have a decent debugger after all these years
>>105979563printf is all you need
>>105979563GDB is a decent debugger, just read the 60,000 info pages and you'll be good to go.
>>105979025I am on 32bit x86.
I know the name, I just didn't know how to write the conditional.
But I have made some progress.
I have managed to break in main and get the name like so:
print **(char***)($bp+12)
But now when I try it in the conditional, the $bp turns out to be invalid...
As for the exec business, I was using commands like "x/10x $sp" to get the name. But I didn't know how to put that in the if statement. The commands must not work as expressions, so I can't use them here. I must use the c functions...
But I'm not sure if strcmp will work. It keeps saying "No symbol table is loaded. Use the "file" command." when I try to use it...
>>105978478challenge 0 - identifying joke images
>>105978904I am a programmer that loves simple things.
If I don't grasp a new concept in a matter of seconds then I immediately know there is no point in learning it. Complex stuff is doomed to fail.
Call it good taste if you wish.
>>105979235I'll celebrate by plowing ahead. I am very pleased though, textured software rendering was probably the hardest set of functions to decompile in this entire project.
>>105979362I tried to learn them but failed to do so in an acceptable time frame. Thus my programmatic sixth-sense tells me they are unworthy of my time or anybody's time for that matter.
In Haskell there are good monads like `Maybe` and bad monads like `State`, `IO` and the like. These ones are atrocious. They hide stuff that should be apparent in every program. Haskell fags try to sell the idea that you can shoehorn an arbitrary procedural program into a set of pure FP calls. Which is stupid. Procedural contains pure FP and not otherwise. Hence the pulling of everything state under the rug. It is a hack which doesn't solve the needs of the programmers.
>>105980252Does that apply to maths too?
Some complex concepts are necessary.
The software is still useful.
The binaries/src for useful software will probably always be around somewhere to use.
Plus, learning concepts is surely good for improving the mind, right?
Why do you post this cute plush?
>>105980430What should be the output of
main = head [print 0, print 1]
be?
>>105980430>an acceptable time frameArbitrarily decided by you?
Also you know very little about non-functional languages if you think they're all close to the machine and "pull nothing under the rug". Modern CPUs are not "procedural"
>>105980740The result of the first `print 0` call?
Which could be the return code (0=OK, -1 = some IO error)
>>105980884Would you waste your time in learning the contrivances of a good for nothing language? I prefer to switch to a sane language.
Out of the most popular functional languages only Haskell is "pure FP" retarded. Scala, F#, Clojure, ... all of them are multi-paradigm and allow mutation, while encouraging FP.
Did you know the first version of Haskell couldn't even do console I/O? Because it did not fit the "purity"! Yes, you have read it right: Haskell v1 couldn't do a simple hello world. And in modern Haskell you are required to grok the path of functors, monoids, monads, effects, the do block,... a hello world program is the final boss. I don't have like 10 days to learn all this. Call me a pragmatist!
>>105980980Did it take you 10 days to learn all of procedural programming? Haskell is better than all of those because it is pure FP. Monads, applicatives, arrows, comonads etc are one of the best parts of Haskell. You are simply an idiot.
>>105980992When you know Haskell, monads do not get in your way, in the same way that procedures don't get in your way in C. You just understand you are building bigger and more complex procedures with expressions and not executing them, until you have built main. It's not even that radically different from C.
Haskell has been called the best imperative language because you can build custom control structures, layer monads on top of IO or state, separate out IO into distinct effects that are safer and can be mocked, use less powerful abstractions to introspect more, etc
>>105978449you might like roc , but it's still early days yet.
https://www.roc-lang.org/functional
With the bonus of having a fun gimmick for functionality/ library grouping
https://www.roc-lang.org/platforms
>>105981062>Haskell has been called the best imperative languageIt will never be an imperative language. It is a transvestite.
>>105980992>Did it take you 10 days to learn all of procedural programmingNo
>loops are exclusive to my shitty paradigm
wwwwwwww
how do you do that thing in C++ where you can construct an object in a different location through function calls?
Like if I have a class that contains a vector and I want to push a new element to it, I can create a function on that class to 'addElement' then wherever I call that function I can 'create' the object locally and pass it in, except it doesn't actually get created until the addElement function is called and that function calls push_back, only then is the constructor actually called and the element is created in place inside of the vector
class C {
addElement(Element &element) { ... };
vetor<Element> elements;
};
void foo() {
Element element(...);
c.addElement(element);
}
something to do with std::move? thought I don't think that's right because if your element cannot be moved then this doesn't work right?
>>105981366you need a raw buffer of some aliasable type like char, std::byte, etc, and to either use placement new or construct_at or something like that.
// this needs aligning too
char bytes[sizeof(Element)];
Element* element = new(bytes) Element(...); // <- placement new
...
element->~Element(); // <- manual destructor
>>105981366std::move and elements.emplace_back?
Or something with placement new operator?
>new (address) (Element)(args)
>>105981162What if print 1 was non-terminating? Does church-rosser suggests a program with a valid terminating case should always be reachable?
i'm vibe coding a sidebar with customizable widgets to "fill" the extra space when using librewolf at the default window size (helps with fingerprinting)
developed mostly php my whole life
AI really helped me bridge my knowledge and build an app
ty gaben
>>105981694>a C# sidebar*
>>105980252>If I don't grasp a new concept in a matter of seconds then I immediately know there is no point in learning it. Complex stuff is doomed to fail.You're pissing your life away. Some concepts take longer to grasp. (They're fundamentally simple, but the intuitions are sophisticated as to why they should be done in one way and not another.)
If you only stick to things that you can understand immediately, you're running below your true mental ability.
>>105978637>Ideally the most expensive calls are done first to reduce later register pressurethis doesn't make any sense. how expensive a function is doesn't affect how the register allocation is done by the caller
>Year of Our Lord Jesus 2025
>Applicative and traversable functors (aside from particular instances) a rarity outside of Haskell
we still have retards getting filtered by immutability, it'll be awhile yet.
Well at least maybe there are specific applicatives in other languag
>https://en.cppreference.com/w/cpp/ranges/zip_view.html
>https://en.cppreference.com/w/cpp/ranges/zip_transform_view.html
>When calling with no argument, views::zip() is expression-equivalent to auto(views::empty<std::tuple<>>).
>When calling with one argument f, let FD be std::decay_t<decltype(f)>, if: ... then views::zip_transform(f) is expression-equivalent to ((void)f, auto(views::empty<std::decay_t<std::invoke_result_t<FD&>>>)).
>not repeat_view
oh no no no no
>>105981926somehow they maded to NOT fuck this up for cartesian product which is honestly way more surprising because you expect a democratic committee like C++ to constantly make the worst possible choice
>>105981813Consider two cases
f(x) + y
t0 = x
t1 = f(t0)
t2 = y
t3 = t1 + t2
y + f(x)
t0 = y
t1 = x
t2 = f(t1)
t3 = t0 + t2
clearly in the second case t0 isn't free during the evaluation of x or f, so ideally the more expensive half of the expression (in terms of registers) is done first. This is true when there's no caller/callee convention and the only aim is to avoid spilling
>>105981162That breaks lazy semantics.
>>105982042ok I see what you mean, but the compiler can only use unsued registers for the function f, if f only called once. otherwise if it's called more than once, it's unlikely that the 2 or more callers will have the same set of unused regiters and in that case if must follow a calling convention concerning who (callee or caller) needs to save which registers
>>105980430funny that you got filtered by State, which is completely pure, for being magical when "State s a" is literally just a thin wrapper around (s -> (s, a)). There's literally nothing bad or evil about it.
>>105981725>Some concepts take longer to graspSome concepts take a long time to learn but are straightforward. Others take a long time because they are complex. Do not mix the two. The latter are a time grab. In professional programming you avoid these like the plague. Technologies exist to serve the programmer and not otherwise.
>>105981888Immutability started to be shilled everywhere because retards couldn't into concurrency anymore.
>>105982402nta
1. it is straightforward
2. professional programming is not about being beginner friendly
>>105982303I get the type. But the problem is the code it usually gets called from: completely obscure, hides the side effect mechanism (context) instead of making it explicit to the reader, and to add insult to injury it tries to look procedural. This is sadly how this type was meant to be used.
>>105982421>2. professional programming is not about being beginner friendlyYes it is, because maintenance makes for the most work in the life time of a project, and companies want code to be serviceable by cheap new hires.
Projects that only one guy understands do not live long.
>>105982530What a fucking LARP, imagine stating something so completely false. Yeah there are tons of beginner jobs, nobody is hiring anyone experienced!
You know I really wish the language I had learned was completely redesigned for beginners so that
1. 0 resources are spent on improving the language for the non beginners who actually use it
2. There's 0 point fucking using it because of 1
3. There's 0 point fucking learning it because of 2
This is like when ESLs complain about English being difficult to learn as if it's a bad thing, like other people's native language has to be some fucking open skill to them
>>105982966uhh you can't just heckin mutate
>>105938643It heavily depends on the specific use case, acceptable limitations and necessary guarantees.
>>105982493>hides the side effect mechanism (context) instead of making it explicit to the readerthis makes no sense, functions using State are typed as State, the static type makes the effect explicit. If you care about implicit effects you should be whining about every other language that does NOT mark them.
>>105983062import Control.Monad.ST
import Data.STRef
for start cont inc body = newSTRef start >>= go where
go y = do
i <- readSTRef y
if not (cont i) then return ()
else do
body i
modifySTRef' y inc
go y
fvark = runST $ do
n <- newSTRef 0
for (0) (< 100) (+ 1) $ \i -> do
modifySTRef' n (+ i)
readSTRef n
main = print fvark
return sizeof int; // ERROR
return sizeof(int); // NO ERROR
hello sir, can compiler string pooling be applied to constants other than string literals?specifically gcc/clang
int main(void)
{
/* char[] */
printf("%p %p\n", "string", "string");
/* int[] */
static const int a[] = {1,2,3};
static const int b[] = {1,2,3};
printf("%p %p\n", a, b);
}
>>105983516-fmerge-all-constants
>>105968826Ignore the toolset anon, that's only for python stuff.
You NEED visual studio because clion isn't a JIT debugger.
If your code crashes without running in a debugger, it usually triggers the JIT debugger, which is visual studios.
I have tried jit debugger alternatives but they open without dialog (AKA, if a random program crashes, it will open windbg or something, without asking, ONLY visual studio will ask before opening).
BUT the jit debugger doesn't happen during an abort on the release runtime, which is usually caused by an assert or uncaught C++ exception, it gets sent to WER (somewhere random in your files a mini crash dump is stored but it gets cleared when you restart your PC I think).
The release runtime is still worth debugging since you can read a partial stacktrace (RelWithDebInfo instead of Release on cmake). I disable WER in registry (this used to be a feature you could click on in windows 7, but they removed it in windows 8).
Also if you were autistic about core dumps, it's possible to use microsoft azure to build your code with a symbol sever with indexed symbols so that if you gave the debug build to someone, they don't need the PDB file, they can send the core dump (created with procdump could be hundreds of megabytes, may need to be zipped). And you need a microsoft account + visual studios because the symbol server is tied to your azure account.
But for a optimized build you would use bugsplat.
Also if you don't have a MS account you can reset the trial with this: https://github.com/beatcracker/VSCELicense
On a whim I decided to try out migrating my setup from Ubuntu to NixOS. It was not fucking worth it.
I'm so incredibly bored but I have no idea what to do. All I know is that I don't want to do toy projects. If you have any suggestions please tell me.
>>105985402what languages do you know/use?
>>105985436I don't use any because I have nothing that I want to do but I know most. C/++, JS, PHP, would be the ones I'd enjoy using most.
>>105944865that thing still exists? i thought it was dropped with visual studio 2008+
isn't this what you want?
https://stackoverflow.com/questions/1508973/how-to-search-for-file-names-in-visual-studio
>>105968826MSVC compiler is fucking horrible, at everything. Just install MinGW or LLVM, they're open source, better at optimizations and work out of the box without telemetry and other niggerlicious shit
>>105986752both of those are outperformed by MSVC at everything
MinGW you don't even need to bench, you can time it with a stopwatch
Alright my OS has kmalloc now. What next?
Can I ask how you people use version control systems?
I still find them very confusing to use.
For example, I often want to have 3 different versions of a piece of code available to me. I really do not want to have 3 branches of the code because then it is very easy to accidentally modify the wrong branch. I basically just work by copy/pasting directories, until I have something I am happy enough with to commit, at which point I will clean up and commit a clean version.
But I understand that most people don't do it this way and this is the wrong approach?!
>>105987308>, I often want to have 3 different versions of a piece of code available to me.That's retarded so your best option is to copy paste.
If I have two different ways to implement something, I just make some tests and see which version is better. If that doesn't work, I pick one at random.
>>105987308>I often want to have 3 different versions of a piece of code available to me.Git worktree. I think they still need to be separate branches though.
>>105987096Virtual memory?
>>105987308Oh, you can also save changes in a .diff, I guess.
>>105987619I did that before kmalloc. I decided to do a rudimentary shell.
https://graphics.cs.utah.edu/research/projects/avbd/
Can ChatGPT vibecode me up an implementation of this in GLSL compute shaders
>>105978129isn't that just strace?
>>105987874Good morning, sar. This is /dpt/ and you appear to be looking for /gpt/.
Why is there no language that will let me do this
struct Vec<T: type, N: uint> {
operator`.`(self, attr: comptime Literal[x | y | z]+) -> Vec<T, Length(attr)> {
// ...
}
}
v = Vec(1.0f, 2.0f, 3.0f); // Vec<float, 3>
a = v.x; // Vec<float, 1> ( <=?=> float )
b = v.xxy // Vec<float, 3>
c = v.zyxyzz // Vec<float, 6>
which is better?
car.paint(red)
or
paint(car, red)
>>105989059A car cannot paint itself so the latter. OO is stupid
>>105988960doable in ghc/haskell
>>105989242Give me some keywords to Google
>>105989059car #red paint
Simple as.
>>105989059Paintjob paintjob = Paintshop.newJob();
paintjob.preparecolor(red);
paintjob.put(car);
paintjob.apply();
>>105989085OO is only as stupid as the developer using it
>>105989370>OO is only as stupid as the developer using itWhich automatically means plenty stupid. There's no reason to ever use it.
>>105989285it would take a lot of work
>>105989059>car.paint(red)>implying the car knows anything about rendering>paint(car, red)>implying the renderer knows anything about carsBoth are wrong.
>>105989395just stop being dumb, then
OO is great if your smart
>>105989426>OO is great if your smartBut you're not smart and neither is anyone else using POO.
>>105989440you're projecting, anon
>>105989473You're POOjecting, jeeter.
>>105988960Easy to do in Nim
>>105989059Why not both and then you can pick whichever :)
>>105989285>>105989397behold this abomination
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE UndecidableInstances #-}
import Data.Kind (Type, Constraint)
import GHC.Records (HasField(..))
import GHC.TypeLits
type Vec :: forall k . [k] -> Type -> Type
data Vec n a where
VZ :: Vec '[] a
VS :: !a -> !(Vec n a) -> Vec (x ': n) a
deriving instance Show a => Show (Vec n a)
type Elem :: forall {k} . [k] -> k -> Constraint
class Elem as a where
extract :: Vec as x -> Vec '[a] x
instance {-# OVERLAPPING #-} Elem (a ': as) a where
extract (VS a as) = VS a VZ
instance {-# OVERLAPPABLE #-} Elem as a => Elem (b ': as) a where
extract (VS _ as) = extract as
type Swizzle :: forall {k} . [k] -> [k] -> Constraint
class Swizzle a b where
swizzle :: Vec a x -> Vec b x
instance Swizzle a '[] where
swizzle _ = VZ
instance (Elem a b, Swizzle a bs) => Swizzle a (b ': bs) where
swizzle v = case extract @a @b v of VS z VZ -> VS z (swizzle v)
type SymbolList :: Maybe (Char, Symbol) -> [Char]
type family SymbolList n = r | r -> n where
SymbolList 'Nothing = '[]
SymbolList (Just '(c, cs)) = c ': SymbolList (UnconsSymbol cs)
instance (SymbolList (UnconsSymbol s) ~ m, Swizzle n m) => HasField s (Vec @Char n a) (Vec @Char m a) where
getField = swizzle
xyz :: a -> a -> a -> Vec ['x', 'y', 'z'] a
xyz x y z = VS x (VS y (VS z VZ))
-- >>> (xyz 10 20 30).xyz
-- >>> (xyz 10 20 30).x
-- >>> (xyz 10 20 30).y
-- >>> (xyz 10 20 30).z
-- >>> (xyz 10 20 30).xx
-- >>> (xyz 10 20 30).yy
-- >>> (xyz 10 20 30).zz
-- >>> (xyz 10 20 30).zzyyxx
-- VS 10 (VS 20 (VS 30 VZ))
-- VS 10 VZ
-- VS 20 VZ
-- VS 30 VZ
-- VS 10 (VS 10 VZ)
-- VS 20 (VS 20 VZ)
-- VS 30 (VS 30 VZ)
-- VS 30 (VS 30 (VS 20 (VS 20 (VS 10 (VS 10 VZ)))))
>>105988960>Why is there no language that will let me do thisYou can do this in nim. I actually implemented it myself once upon a time while making a GPU programming ESL.
>>105986752Address sanitizer is the only thing saving C++ from being thrown into the garbage.
mingw does not have address sanitizer (including clang from msys2 which uses mingw)
clang with msvc AKA clang-cl (you need to install MSVC) has address sanitizer but it does not work with the debug runtime (this causes a lot of problems with vcpkg, also the debug runtime is convenient). And if you don't install visual studios you wont have a JIT debugger that works nicely with random applications crashing.
>>105984101If not having address sanitizer isn't enough to scare you away, also note that mingw suffers from the msvc release runtime, and it's suffering because for some reason gdb cannot catch aborts. There are a lot of workarounds, such as retarded ones like setting codeblocks to catch all C++ exceptions (wont work for aborts caused by assert), to less retarded ones like custom abort handler triggering __debugbreak / gdb break abort.
And also did I mention that mingw doesn't have a JIT debugger/coredumps? If your code crashed once in a blue moon (you finished the project, you aren't debugging it, just using it as you intended), if it crashes there is NOTHING you can do to debug it. The stacktrace is impossible to retrieve (printing a stacktrace / building with debug info on a optimized build is worth it, there is no binary size difference, no performance difference).
>erm actually I can get a stacktrace! I use the unhandled exception handler and print a stacktrace from there!wont work on a stack overflow. also wont print a stacktrace of non mingw symbols (like if you crashed inside of opengl, AKA you did something stupid like pass a null ptr, you wont see the opengl function on the stacktrace due to no dwarf debug info).
>I use dr mingw, plus it has JIT!If you set dr mingw as the JIT debugger it's gonna open for all programs that crash.
You only get a stacktrace, you can't inspect memory like a core dump/JIT.
msys2 clang needs a flag to work with dr mingw.
>>105989575>>105989613Can it be type safe in Nim?
>>105989735>Can it be type safe in Nim?You'd have to do something weird for it not to be.
>>105989419>implying the renderer knows anything about carsI don't have to know the car. I can just empty a bucket of paint over it. A car cannot.
>>105989613>>105989761let me guess, it can't swizzle at runtime?
I have mostly reimplemented Signal in core Java 23. I am trying to decide if I like it or if I should make something else.
>>105989836no with
>>105989577 you could call swizzle overloads at runtime even if you can't do .xyzetc obviously
>>105989910In what real world (might be hard to imagine for someone that uses Haskell) situation would you want to swizzle at runtime?
The Nim version obviously uses macros which means it has zero extra runtime overhead.
>>105989778>I don't have to know the car. I can just empty a bucket of paint over it.Found the python/JS "coder".
>>105989786>type-safe runtime swizzlingEh?
>>105990097i just mean the same thing used to type safe swizzle could be done type safely at runtime
>>105990074Found the projectionist
>>105990106Meaning what? Provide a code example.
>>105990125Let's see how you implement your draw(car) function in a statically typed language without trying cars to rendering in some manner through the type system.
>>105990137i already provided more code samples than nimanon, why should i do even more work
>>105990180To me "runtime swizzling" implies instead of v.xyz you have v[some runtime variable list of symbols] which sounds like a retarded thing to do.
>>105983439Is this a compiler or language flaw?
>>105990276I'm just saying you can do that on top of what .xyz was built to use from my haskell code
>>105990799>I'm just saying you can do that on top of what .xyz was built to use from my haskell codeBut that's not a good thing.
>>105990833>it's not a good thing that you can call a function
>>105990866>always pay for dynamic lookup even though you never need it>this is a good thing
>>105990920inlining either works or doesn't unless you're suggesting 99% of functions be macros
what's the difference between raytracing on an engine using RTX raytracing and the shadertoy raytracing that was made before RTX was a thing?
Is it exactly the same thing under the hood except you enable a nvidia extension in the shader and switch to whatever a tensor is?
Or is it a completely different thing?
because like, in those shadertoys, I think every pixel gets like 100 samples, sampling from a signed distance field, a fractal, or something, so de-noising isn't required, but why does RTX require denoising? couldn't it just shoot the same 100 samples with the same pixels, or is it because it's just too slow for that?
>>105990933RTX uses RTX cores
>>105990946yes but what's the point of de-noising, couldn't you just shoot a ray at every single pixel?
are the tensor cores only for denoising?
>>105990958tensor doesn't mean RTX
de-noising is for firing fewer or less accurate rays and getting better data out of it, with the idea of being faster than firing more rays
>>105990925I suggest that if your implementation of v.xy isn't guaranteed to compile into ((&v)+OFFSET_X, (&v)+OFFSET_Y) then your implementation is retarded. Simple as.
>>105990995So if it compiled to the actual constant it had determined one would inevitably evaluate to, then that would be retarded?
>>105991006Fair enough, anon. You get me there. What I meant is that ((&v)+OFFSET_X, (&v)+OFFSET_Y) should be the guaranteed worst-case scenario.
>>105991080>totally arbitrary new requirement
>>105991116but yeah, it is still possible in Haskell, I can't be bothered to do it though, but replace the extract shit with an offset and so and so on
This may be the wrong thread but please ignore me if you aren't looking to give career advice. I am looking to move up in a very small, family-owned tech company that produces a series of embedded systems and Windows applications. I am a QA guy who does a good amount of product support and account management as well. I am 26 years old and I'm currently finishing an Information Science and Cybersecurity Risk Analysis double major. I could easily take over for the sys admin here when he eventually retires (not sure how long I'll have to wait) but I would hate to waste my years of experience with our products and customers, so right now I'm just exploring my options.
I do not have much programming experience but I'd like to determine how I could get my feet wet doing projects similar to what my devs do here. I believe their current stack of languages are C, C++, C#, and some Java. What are some simple projects I should set goals to create? Ideally I'd like to start with C and work my way up from there. What sort of projects do fledgling coders make to get familiar with basic concepts? When should I feel comfortable talking to my boss about a change in positions? If I don't get replies here I'm definitely pasting this in a different thread so apologies for the spam.
>>105991116>arbitrary>newNo, it isn't. It's the worst-case scenario for reading the field of a POD in sane programming languages and there's absolutely no reason why it shouldn't be the same for swizzling. If your implementation doesn't live up to that standard, it's shit.
>>105991268You realise not every language is C, right?
>>105991305It works that way in most statically-typed mainstream languages, not just C. Sounds like Haskell is literally a script kiddie language at this point...
>>105991346>it works that way in most C derivativesYeah, if it wasn't the exact same as C it would have to be a script kiddie language because everything is C. Nevermind that even your C compiler can do almost whatever the fuck it wants if you're not doing shit with the address
how do you guys structure your libraries docs for the functions if you want it in the README.md only since the library is farily small, i have it as:
codeblock showing function signature
description
arguments description
but its coming out kind of ugly, should i have the name of the function as a header first and should the arguments description be in a list or just text?
don't put function description in README...
You can put example there to get started.
You can have directory with many examples.
Nobody cares about your function signatures.
>>105991305>Only C accesses data with a simple movAnd FPtards wonder why no one takes them seriously.
>>105991440This is cope. The nim implementation will do exactly what I said - guaranteed - making proper use of the static type information available at compile time. Just like every compiler for most statically typed languages. Meanwhile your implementation takes pride in incurring unnecessary costs for normal use cases and it's supposed to be "good" because it lets you do something retarded no one wants to do?
>>105991237>I'd like to start with C and work my way up from theredoesn't work like that
C/C++ and C#/Java are two different worlds facing away from each other. One language's conventions and practices are another language's grave sins
especially if your end goal is to get employed, best to pick just one language and specialize in it
as for projects, focus on writing stuff that actually does something useful for you or someone. even if it's something trivial but still something that would actually be used - not a "write, check if it works, it does, forget about it" kind of project
"exercise projects" are good for theorists but do not offer much practical experience
>>105991521there will be examples too of course but i want some written docs also
>>105991590if your API is not self documenting... ngmi
>>105991558You have literally no idea what you're talking about because you have no experience outside of C derivatives. It doesn't even occur to you that if you have a local struct and aren't manipulating the address, C compilers can break it up and re-arrange it however they want.
>>105991449link to html generated from javadoc
>>105991608>You have literally no idea what you're talking about because you have no experience outside of C derivatives.Then you should be able to provide an example of a compiled, statically typed language whose mainstream compilers do worse than the field offset code.
>C compilers can break it up and re-arrange it however they want.We've already been through this. You can count on it performing no worse than the code I posted.
>>105991630Virtual base access in C++
Also don't reddit space, faggot
>>105991641>dumb newfag doesn't know what "POD" means>dumb newfag doesn't know what redditspacing meansThis board only gets more retarded every time I visit it.
>>105991630>>105991641And this is all besides the point because you have never and will never learn a language that isn't a fucking C derivative. I'm fucking telling you shit is different and you're asking how it does the same things. 0 perspective at all
>>105991651They don't even use POD in C++ anymore btw but I bet you didn't know that either. Btw maybe next time don't cram your faggot shit into someone asking why there are no languages that can do a thing, and that thing is then done. You still haven't even posted code doing it yet you're desperate to be up my ass that I actually posted a solution that doesn't satisfy YOU (a fucking nobody) and your requirements. I wasn't trying to solve your fucking problems. Kys
>>105991671Notice how I correctly predicted your inability to name a single example.
>They don't even use POD in C++ anymore Holy shit what a retard.
>>105991679You can't name a single dick that isn't up your fucking ass, faggot.
You can't even say you meant C anymore since you've just complained about that too
https://en.cppreference.com/w/cpp/named_req/PODType
Hey here's an example for your question I have no obligation to answer that won't compile to field offsets: SIMD shuffling
>>105991590Why not host on github/lab sites or similar with a doc generator?
>>105991671>a language that isn't a fucking C derivativeThe exact same thing applies to Pascal/Fortran/Cobol/Ada/<insert compiled language> and dynamically doing shit like that will always be slow as molasses. Stop coping.
>>105991789>Pascal/Fortran/Cobol/Ada/Uh huh so more procedural imperative languages that share a lot of heritage with C. You really got me there. You realise if that was a single fixed record type, and it existed in that form at runtime, that GHC would use fixed offsets? You have literally no idea what the code even does, but a simple fucking one off solution made in a couple of minutes to prove something to anon has really got your panties in a twist. You have yet to even provide one (1) solution when anyone, even chatgpt, could do a macro solution. I could do a fucking macro solution in Haskell.
>>105991811Ah, so now it's just "shared heritage" down from "C derivative". In reality, it's any language that is based in the real world and on how computers actually function.
Keep coping with your irreleveant slop and screeching at anons that call out your bullshit.
>he's still angrily typing up a reply to either complain a class with a virtual base isn't a POD or to actually address anon's problem from hours ago
>he hasn't realised nobody fucking cares about his question or his extra fucking qualifiers that it must be a compiled language, must be a POD, must be a field access, must make his parents love him
>>105991871>it's any language that is based in the real world and on how computers actually function.lmao it's a good thing mallocfag isn't here because he's 10x as autistic as you
>>105991671>you have never and will never learn a language that isn't a fucking C derivativeLearn Lisp or Fortran or SQL then
>>105991766Still waiting for you to provide an example of all those secret languages I'm unaware of. You won't do so in your next post, either. Dumb script kiddie.
>https://en.cppreference.com/w/cpp/named_req/PODTypeThis is deprecated but that doesn't mean C++ doesn't have POD types, tard. You literally don't know what a POD type means.
>>105991952He would throw a fit upon realising something isn't working as C would
>>105991980>retard doesn't know what "POD" meansConcession accepted.
>>105991956Some people are so parochial and myopic. They're best consigned to vibe coding, where their skills won't cause so much damage that anyone gives a fuck about.
>>105991956>>105992071Notice how you still can't provide an example of a compiled, statically-typed programming language where a POD field lookup is slower than a pointer+offset read.
>>105992114Java using reflection
>>105992125>JavaA POD field read in Java is no slower than pointer+offset.
>b-b-but what if I use reflectionEnd your life tonight.
>>105992245Java does not even have PODs
>>105992260>it's yet another episode of the same retard still not knowing what POD meansYou've had like an hour to google it. You have an impressive dedication to remaining ignorant.
>>105992400Java classes are not plain old data
>>105992419You're a dumb nigger and it's clear now that your screeching about my knowing only 1 language was pure projection.
>Still no usecase example has been posted