[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] [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: 1742424547800.png (220 KB, 1500x2462)
220 KB
220 KB PNG
Rust projects fake benchmarks edition

What are you working on, /g/?

Previous >>107325387
>>
>>107370538
I miss the maidposters. Maid /dpt/ was way better than this.
>>
>>107370538
>people who can't admit what they are lie about mundane things
I'm shocked
>>
I don't give a fuck about memory safety!
Raw pointers are fast and fun!
>>
>>107366291
What I learned from this is that on -O2 the compiler goes
>Fuck you, I do what I want.
>I know what you're trying to do, let me handle this you idiot.

Also thanks to the anon who pointed out to me that gcc has builtin crc implementations.
>>
>>107371043
>Not using vpclmulqdq
Using tables is really slow. Does GCC still use tables with -march=native or -mavx2 -vpclmulqdq?
>>
File: lumi tardworld.jpg (430 KB, 1630x917)
430 KB
430 KB JPG
>scalable api architecture
>>
File: -mvpclmulqdq.png (165 KB, 1920x940)
165 KB
165 KB PNG
>>107371229
>Using tables
Oh, is that what it's doing? So that's what all those .values above are. Makes sense now.

>Does GCC still use tables with -march=native or -mavx2 -vpclmulqdq?
Looks like it.
>>
>>107371429
Tables are much faster than your bit at a time code, but with vpclmulqdq you can go 8 or 16 bytes at a time which will be far faster than anything except dedicated hardware.
>>
I want to make a simple Twitter bot that posts an image from a repo every few hours. How in the hell would one go about this with the v2 API?
>>
>>107371504
>but with vpclmulqdq you can go 8 or 16 bytes at a time
Ah, makes sense that it wouldn't use that for a function that only takes 1 byte at a time as input.
>>
>>107370538
what is the default sort on Linux tho?
coreutils sort? or what is the other one?
>>
File: __builtin_crc64_data64.png (280 KB, 1919x963)
280 KB
280 KB PNG
>>107371504
>>107371531
Although looks like the builtin 64bit implementation is still using tables.
>>
>>107371669
Try calling the builtin in a loop over a buffer like you would for actual code, and see what it does. The docs do mention using clmul sometimes, but I'm not sure what that depends on.
>>
God fucking damn it. Why does it have to be so hard to read from stderr for 7zip on windows. I fucking hate this shit. I just wanted some nice progress bar for my package manager but it's just not going to be possible. I asked every single AI in existence, I've searched all over the place. 7zip outputs progress to stderr but it seems like if I want to read it in a separate thread, it just buffers it so nothing is even sent to the separate thread until the end. I'm so fucking done with this. All this for a progress bar.
Fuck this. Fuck terminals. Maybe I should've invested in a UI instead. Any help appreciated.
Is this such a hard problem? I don't think so. Maybe I'm retarded. Help me niggerman.
Actually managed to solve it midway through writing this post. AI is definitely not taking any jobs because it's retarded. 7zip uses \r for updating progress on stderr, but the rust standard library splits on fucking \r\n or \n of course, I want my 3 hours back. All that required was basically 1 line of new code.
Instead of doing
for line in reader.lines() {
}

I should've done
for line in reader.split(b'\r')..map(|res| res.map(|bytes| String::from_utf8_lossy(&bytes).to_string())) {
}

I feel like a fucking idiot for not realizing this sooner.
>>
>>107371756
RTFM
>I asked every single AI in existence,
oh no, how could this happen?
>>
>>107371756
Imagine writing code so slow that user can follow a honest progress bar.
>>
>>107371669
Builtins are in case you want to modify crc constants.
Use Intel intrinsic on x86_64, it is hardware based and allows running about 3 simultaneous checksums per thread.
>>
>>107371993
He's doing crc16 and the x86 instruction is crc32 only.
>>
>>107372029
Then he shouldn't LARP about performance.
>>
>>107371756
>All this for a progress bar.
In programming most simple things are complicated. Progress bars notoriously so.
If anything is ever simple it's because someone else has solved it and neatly packaged it for you to use.
>>
>>107371798
>RTFM
>>I asked every single AI in existence,
>oh no, how could this happen?
Yeah my bad for not reading the manual properly but AI is marketed as this big thing that'll supposedly replace me and all my buddies in 2 years time.
So of course I wanted test its prowess to solve this issue but as it turns out trillions of parameter cannot solve retardedness. Now I know that AIs need to be avoided for anything hyper specific and are only good for cookie-cutter things.
>>107371952
>Imagine writing code so slow that user can follow a honest progress bar.
Well extracting 500+MB of compressed zip is pretty slow on my machine so it's "nice" to show a progress bar. Nobody likes to see things that just get stuck without any update to the user. Now that I have this working for extraction, I want to also do this for downloads/copy to make an overall "nice" unified experience.
Keep living in the 80s old man, we have more than 2 threads now. The future is now.
>>
>>107372049
>jeet says something about 80s while using zip
zstd prints proper progress bar and wget/curl can pipe directly into zstd
>>
>>107371993
That's above my head at my current level. Maybe some day I will look into doing things like that.

>>107372042
I'm not.
>>
File: screenshot.png (48 KB, 891x530)
48 KB
48 KB PNG
>>107372098
>including a header and calling a function is above my level
???
>>
>>107372070
Most things are still LZMA or DEFLATE in packages land on windows.
I'm building a package manager here and if the package is zipped, nothing I can do about it, especially since it's pretty popular to just zip things into a portable directory on windows.
>>
>>107372110
Sure, if someone spoonfeeds me that's different. But I'd still need to spend some time reading up so that I have some idea of what's going on and not just blindly calling code because some anon on the internet told me to.
>>
>>107372224
It's one hardware instruction.
>>
>>107372209
chocolatey already justwerks
>>
>>107372288
Mine's gonna also justwerk but better
>>
>Mine's gonna also justwerk but bet...unwrap()-ACK!
>>
>>107372274
Exactly. It's a hardware instruction. I have no clue what I'm doing on that level.
Fine if it's abstracted into a simple function call in a high level library, but the trick is not to call the function the trick is to know what function to call. And how and when.
And like other anon pointed out, this does not seem applicable to what I'm currently (supposed to be) doing.

Still, it's cool you mentioned it. Maybe it will ring a bell in my head if I ever have cause to look into it.
>>
>>107372347
It's not like fixing bugs in your code is unheard of.
>>
File: safe knife.png (761 KB, 952x635)
761 KB
761 KB PNG
>>107372384
I heard that Rust prevents bugs before they happen.
>>
>>107372401
I heard you're an idiot.
>>
>>107372375
Good on you for recognizing what you still need to learn. Out of curiosity, what are you writing this crc16 code for?
>>
>>107372449
I'm not the one struggling with progress bars bub.
>>
>>107371691
picrel

>>107372470
A hobby project of trying to write an .mp1 decoder. The test file I'm working with had a crc hash embedded in each audio frame so I thought that was a good opportunity to take some time to learn how Cyclic Redundancy Check works and figure how to implement it.
And then that led me on a sidequest to marvel at how the compiler magically optimized away the bug I intentionally introduced in my implementation to check my understanding.
>>
>>107372618
>compiler still not using vpclmulqdq
Oh well. If you want to learn assembly, this is a good place for it.
Btw, use memcpy to load 8 bytes into a 64 bit int instead of writing all that out. It compiles down to a mov instruction.
>mp1 decoder
So you have no freedom to use a different CRC function then like the one implemented in hardware, and you can't use the crc32 instruction. Neat project though.
>>
>>107372618
>the compiler magically optimized away the bug I intentionally introduced
if true then it's a compiler bug, optimizing compilers should never modify the semantics of a program
>>
>>107372698
>If you want to learn assembly, this is a good place for it.
Thanks. I just don't want to be completely handicapped when it comes to understanding what the compiler does to my code. This seemed like as good an opportunity than any to dip my toe into the water.

>use memcpy
Right, forgot about that.
>It compiles down to a mov instruction.
So did my bit shifting, if I understand the assembly output correctly.

>So you have no freedom to use a different CRC function then like the one implemented in hardware
Exactly. I started out watching a theoretical explanation of CRC and tried to implement that in code. It worked as far as how that video explained it, but didn't at all for what I actually needed it for. So I got anons here to help me with the problem. It works now, and I've learned new and interesting thing over the last few day. Still can't say I fully understand the theory though to the point where I would be able to explain it to someone else.
>>
>>107371565
quicksort + insertion sort
>>
>>107372866
>then it's a compiler bug
I guess. I'm mostly amazed it recognized what I was doing to the point it was able to do what it did.
>>
>>107372970
what's the bug is supposed to be exactly?
>>
File: frog.jpg (54 KB, 976x850)
54 KB
54 KB JPG
Whole site has been slow lately... Did jannies finally do their jobs for once?
>>
>>107373192
Obviously not since you're still here
>>
>>107373210
I actually contribute to /dpt/
>>
>>107372990
See pic >>107371043
I treat the uint8_t bits parameter as a bit queue buffer. I update the crc for each new incoming bit. So at the end of the for loop I should bit-shift the input data by 1 to bring the next incoming bit forward in the queue. By shifting by 5 (or any other number greater than 1) I should be clobbering my input data which should yield garbage output.
But since at optimisation level -02 or higher the compiler apparently replaces my entire implementation with its ow lookup table, I get the correct crc results anyway (erroneously correct, as it were in this case).
>>
File: image-19.jpg (67 KB, 720x540)
67 KB
67 KB JPG
>>107373192
the population of bots follows the population of human users
>>
>>107373256
>fixed width integers
You need to stop doing this.
>>
File: tweet.jpg (11 KB, 525x160)
11 KB
11 KB JPG
>>107371521
Thanks for nothing /g/ but it's cool I figured it out it wasn't that bad. I made it with TypeScript.
>>
>>107373302
Wtf are you talking about? Did you read this in your clean code newsletter?
>>
>>107372698
>>107372931
>>use memcpy
>Right, forgot about that.
Oh also, not that it makes a difference in that example code, but just straight up memcpy() from a byte buffer into a multibyte variable wouldn't necessarily work in a real application because of endianness. Bitstream data tend to be arranged big-endian (depending on the bit stream specification in question) while variables are laid out little-endian on an Intel machine. So memcpy() might essentially garble the input data if you're not careful about what you're doing.

Sure, ntohs() exists, but that's apparently not ISO standard so then you might end up mucking about with portability.
<< just werks, IMO.
>>
>>107373302
No. Why do you think that?
I specifically LIKE knowing the width of my integers.
>>
File: 1738726377382829.png (511 KB, 2440x1391)
511 KB
511 KB PNG
Just learned you can do this in Godbolt.
>>
>>107372618
There are def pclmulqdq and gf2p8affineqb tricks you can do to accelerate this stuff as well:
https://wunkolo.github.io/post/2020/05/pclmulqdq-tricks/
https://wunkolo.github.io/post/2020/11/gf2p8affineqb-bit-reversal/
https://wunkolo.github.io/post/2020/11/gf2p8affineqb-int8-shifting/
>>
>>107373447
And you do know the width if you aren't a nocoder.
>>107373391
cleancoders are the ones using fixed width, see: Rust.
>>
>>107373256
You did find a compiler bug. Under -O0, using bits <<= 5 produce different results but under -O2 the 2 functions produce the same result and they shouldn't. Replacing your code with another algorithm that use a look up table does not mean the semantics are changed, but here that's the case.

I can't be bothered to report this bug, if someone wants to report it and send this test go ahead.
https://pastebin.com/a785G2bL

#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

/*
gcc -std=c99 -Wall -Wextra -Wpedantic -fno-strict-aliasing -O0
gcc -std=c99 -Wall -Wextra -Wpedantic -fno-strict-aliasing -O2
*/

uint16_t crc17(uint16_t crc, uint8_t bits)
{
for (uint8_t i = 8; i; i--)
{
if (((crc >> 8) ^ bits) & 0x80) {
crc = (crc << 1) ^ 0x8005;
}
else {
crc <<= 1;
}
/* bits <<= 1; */
bits <<= 5; // should be bits <<= 1
}
return crc;
}


uint16_t crc18(uint16_t crc, uint8_t bits)
{
return __builtin_crc16_data8(crc, bits, 0x8005);
}

uint16_t array[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
// not enough space, see the pastebin

0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
};

int main()
{
bool same = true;

for (uint32_t bits = 0; bits < 256; bits++) {

for (size_t i=0; i < sizeof(array)/sizeof(array[0]); i++)
{
uint16_t crc = array[i];

uint16_t val1 = crc17(crc, bits);
uint16_t val2 = crc18(crc, bits);

if (val1 != val2) {
same = false;
printf("crc17(crc=0x%04hx, bits=0x%02hhx) = 0x%04hx\n", crc, bits, val1);
printf("crc18(crc=0x%04hx, bits=0x%02hhx) = 0x%04hx\n", crc, bits, val2);
printf("\n");
}

}
}

printf("%s\n", same ? "same" : "different");

return 0;
}
>>
>>107373578
u32 f1(u32 input) {
u32 sum = 0;
for (u64 i = 0; i < input; ++i) sum += i;
return sum;
};
u32 f2(u32 input) {
u32 sum = 0;
for (u32 i = 0; i < input; ++i) sum += i;
return sum;
};
>>
>>107373700
I accept your concession.
>>
>>107373724
LOL retard. Disassemble that and you'll see how fucking wrong you are.
>>
>>107373735
both dissassemble into void, write real code
>>
>>107373751
What a stupid troll.
>>
>>107373690
>strlen/sizeof in for loop iteration
>>
>>107373829
what's the problem with that?
>>
>>107373782
You can stop trolling anytime, nocoder.
>>
>>107373690
>if someone wants to report it and send this test go ahead.
Feels almost petty.
>>
>>107374294
You mean that it's an inconsequential bug? Compiler bugs are never inconsequential.
>>
>>107374432
I mean like
>Haha, I found a bug in your software, please fix.
rather than
>This is causing real problems for me.
>>
>>107374519
>>Haha, I found a bug in your software, please fix.
That's how it is and how it should be.
Software bugs are never compartimentalized and can affect many things impredicatably. That's especially worse for optimizing compiler bugs because optimizations are normally completely unspecific to the overall program or to the local piece of programs and can affect any program that contains some code pattern, so faulty optimizations can affect many kinds of softwares not just crc.

I don't know how gcc optimizes the crc into a lookup table, but it must rely on some kind of analysis (maybe Scalar Evolution analysis (https://llvm.org/docs/Passes.html)) and a transformation. Both the analysis and transformation won't be specific to CRC and even if they are, CRC is pretty damn important.
>>
>thought you wrote your function efficiently
>aktually the compiler was designed to recognise that exact function and swap in a pre-written autist version
>>
>>107375198
World relies on autistic compiler devs.
>>
>>107374991
>CRC is pretty damn important
It's one of the potential bottlenecks in network stacks. Yes, it's damn important.
>>
>>107376035
>It's one of the potential bottlenecks in network stacks.
I didn't know that but it makes sense. It's also equally important that the code is correct.

>>107374991
>Scalar Evolution
scratch that, that's for when the number of iterations is not variable. Here it's fixed and a small number so all that is needed is to unroll the loop and continue applying other optimizations.
>>
>>107376289
>when the number of iterations is not variable
*is variable
>>
>>107371565
https://gitweb.git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/sort.c;h=26afc97ec5cca9f4675d61ed7493570bf8d7dbb5;hb=HEAD
>>
too young to die
>>
local mt = {}

function mt:__add(other)
return {x = self.x + other.x, y = self.y + other.y}
end

local v1 = {x = 1, y = 2}
local v2 = {x = 3, y = 4}

setmetatable(v1, mt)

local v3 = v1 + v2
print(v3.x, v3.y)

>Lua
why setmetatable() is only applied to v1? what about v2?
>>
>>107378275
works on my machine
$ ./test.lua
4 6
>>
>>107378275
Because v1 + v2 is v1.__add(v2), why would v2 need the __add?
>is not commutative
Exactly.
>>
File: __happy.png (365 KB, 536x510)
365 KB
365 KB PNG
>>107378288
>>107378290
OH the operator
 v1 + v2
v1.__add(v2)

you're right, thank you thank you
I was unmindly thinking some commutative noise in the back of my head
but no, it's very straightforward
again, thank you bros
>>
File: file.png (276 KB, 1364x897)
276 KB
276 KB PNG
still writing shit DSP code..
>>
nobody on /g/ programs anymore
>>
>>107376035
>It's one of the potential bottlenecks in network stacks. Yes, it's damn important.
>>107376289
>It's also equally important that the code is correct.
Use case of degenerate code being optimized correct? Besides tripping up the occasional noob.
>>
>>107379082
No real Scotsman.
>>
>>107379082
>anymore
/g/ was always this
>>
>parallel with --semaphore does not accept stdin args
HOW WAS I SUPPOSED TO KNOW AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
>>
>>107378332
how can i write stuff like HLSL in c++ and get speed like HLSL
i got brainrot from writing too many shaders
>>
>>107379213
run parallel --semaphore with parallel so the parent parallel builds the semaphore command line
>>
I just want to say that /g/ is the best board in 4chan and the only one that matters now ever since: /biz/ died because of jannies deleting everything good, /x/ became a religious debate board, /out/ turned into nothing but East vs West autism, /mu/ never listened to music in the first place
>>
>>107370585
What ever happened to the maid dev shit? What were they even making? Did all the maids die out?
>>
>>107379126
>Use case of degenerate code being optimized correct? Besides tripping up the occasional noob.
It could potentially also incorrectly compile hash functions and who knows what else.
gcc is an unreliable piece of shit
>>
File: i.png (315 KB, 1309x865)
315 KB
315 KB PNG
Bouncing Balls, Win32 + C++20
One file compilable with Native Tools Command prompt: cl bb.cpp /std:c++20

bb.cpp file content:
void copyToScreen() {
auto hdc = GetDC(hwnd);
BitBlt(hdc, 0, 0, w, h, hbdc, 0, 0, SRCCOPY);
ReleaseDC(hwnd, hdc);
}
void tick() {
for (int j = 0; j < max; ++j)
for (int i = j + 1; i < max; ++i) {
const auto dx = px[i] - px[j];
const auto dy = py[i] - py[j];
const auto r = pr[i] + pr[j];
const auto dd = dx * dx + dy * dy;
if (dd > r * r) continue;
const auto dvx = vx[i] - vx[j];
const auto dvy = vy[i] - vy[j];
const auto nv = (dvx * dx + dvy * dy) / dd;
const auto nvx = dx * nv;
const auto nvy = dy * nv;
vx[i] -= nvx, vx[j] += nvx, vy[i] -= nvy, vy[j] += nvy;
}
for (int i = 0; i < max; ++i) {
px[i] += vx[i], py[i] += vy[i];
if (px[i] < 0) vx[i] = -vx[i], px[i] = 0;
if (py[i] < 0) vy[i] = -vy[i], py[i] = 0;
if (px[i] > w) vx[i] = -vx[i], px[i] = w;
if (py[i] > h) vy[i] = -vy[i], py[i] = h;
}
}
void draw(){
FillRect(hbdc, &screenRect, hTransBrush);
for (int i = 0, k = 0; k < maxCols; ++k) {
SelectObject(hbdc, hBrush[k]);
for (int j = 0; j < maxPerCol; ++j, ++i) {
const int r = pr[i], x = int(px[i]), y = int(py[i]);
Ellipse(hbdc, x - r, y - r, x + r, y + r);
}
}
}

https://godbolt.org/z/Y3KssTj14
>>
How do people who implement sin and so on know it's within 0.5 or 1 ULP or whatever other requirement? I understand the premise of a sequence that approaches a real number but don't understand how that applies with floating-point numbers
>>
That's it, I'm making Rust++
>>
>>107380317
for real? what's the language speech?
>>
>>107379560
Is clang better?
>>
>>107379560
Nocoder hallucination.
>>
>>107381049
https://faculty.ist.psu.edu/wu/papers/DeepFuzz.pdf
According to this paper, concerning GCC:
>Over 3,410 internal bugs (Yang et al. 2011) have been caught since it is created.
Compare this with how many bugs there have been in total in the BSD kernel.

>>107380959
I don't really know but I suppose that it's a bit better because it's better structured.
I've seen a (boring) presentation where a GCC dev was saying that one of its core data structure had become almost unworkable and they needed to make a big refactor. Because of that it's really not surprising that it is so buggy.
>>
I'm loving rust
>>
>>107381243
>software that is used has bugs found and fixed in it
the horror, compared to software that is used by nobody.
>>
>>107380404
SFINAE but for lifetimes
>>
>>107381663
C++ solved lifetimes already though
>>
>>107381766
Making them all implicit and unchecked is not very useful if you want to archive safety. Ada is introducing limited support of lifetimes for a reason.
>>
What certs do I need to get a job?
>>
>>107381796
Ada is a shitlang and C++ just works.
>>
>>107381809
nepotism
>>
File: 1705603247207535.png (359 KB, 476x749)
359 KB
359 KB PNG
>>107381809
Birth certificate with correct surname is all you need.
>>
>>107381836
>>107381845
What if I pretend to be gay?
>>
>>107381860
What if you stop sucking dick long enough to pretend you aren't?
>>
>>107381962
>unproductive response
Thanks
>>
File: darkeval.gif (2.3 MB, 912x694)
2.3 MB
2.3 MB GIF
I've been working on my Clojure REPL based text adventure. I implemented a tutorial system that takes the player through the basics of how things work.

One of the more interesting parts is that you can choose to spawn an nREPL server and connect to it from your IDE of choice (VSCode/Calva, Emacs/CIDER etc).
>>
>>107381663
You mean have lifetimes be part of the type system and have template parameters be have lifetime types? basically
>>
>>107370538
How do I make the sqlite library in C throw exceptions on db errors, like perl DBI's raise_error flag does? My first thought was to write a wrapper function that checks the return code and terminate the program.
>>
>>107383337
You can implement throw and catch with longjmp, there are libraries that do it.
>>
>>107383337
wrappers solve the issue, what else do you want?
>>
>>107379468
Janny bans maidposters on sight and deletes their threads.
>>
Is The Professional Software Engineering Master Certification what I want to get? Is it the accepted standard?
>>
>>107382996
>print
>print
>print
Also, consider defining a protocol to communicate with the front-end so players can play in the browser or remotely via SSH.
>>
>>107383671
The what?
>>
File: tests.gif (3.81 MB, 1152x960)
3.81 MB
3.81 MB GIF
>>107370538
>What are you working on, /g/?
Just finished fixing all the failing tests and most of the graphical API. Only one gfx function remains but I will save it for latter. It's time to refactor and optimize code so I can run anything non-trivial on actual hardware.
>>
>>107383752
The Professional Software Engineering Master Certification
Set by the IEEEEEE or something
>>
>>107383635
based
>>
I'm tired and my head hurts.
>>
>>107384077
no excuses get back to work
>>
>>107370538
Made a shitty terminal game to refresh my python knowledge.
>>
>>107383839
Only certs that seem at all meaningful would be RHCE or those AWS certs.

You can however straight up buy your way into being a CISO https://www.heinz.cmu.edu/programs/executive-education/chief-information-security-officer-certificate if you were a basic manager for 5 years and have $20k to drop. Same what a masters cost. That's pretty sweet as CISO is the most bullshit job on the executive but no more herding jeets all you do is golf all day with the CEO and answer emails
>>
File: 20251130_194617.jpg (733 KB, 3024x4032)
733 KB
733 KB JPG
>>107383826
Rendering mandelbrot is roughly as good as I can do right now. Anything more complex results in exhausted heap or stack or both.
It takes a minute or so to render this on esp32. It takes about 4 seconds for the official pico-8 emulator to do this, and my emulator on x86 does it pretty seemingly instantly. I wonder how would some other pico-8 hardware would perform here. But either way, this calls for optimizations, profiling and figuring out what exactly ate all my stack. Compiling Lua should not blow it up that fast, but that's probably when the problem lies. After lua is compiled, primary(scratch) heap usage is like 15%.
>>
File: 888.png (332 KB, 574x684)
332 KB
332 KB PNG
thoughts
>>
>>107384751
I'd say he is like the most mentally healthy person
>>
>>107384751
I can solo him.
>>
GNU is an IDE, that runs on Linux.
>>
File: script.png (30 KB, 923x363)
30 KB
30 KB PNG
i am a schizoid that has been talking for literal years on and off here about a programming language i have been workshopping. i would be surprised if any regulars here recognize me at this point.

i've come to report that i've just finally got the entire language design (outside of standard library) down in a well-defined way. in the end, the language is basically just LISP but with unidirectional graphs instead of trees. it goes all in on dataflow as the execution mechanism, and relies on graph substitution for branching and polymorphism. despite this, it is written and behaves similarly to a procedural language, as each character in a code file is a graph (in principle) and it is collections of graphs that define transformations. rather than types, you assign memory properties to different graphs, and graph connections/modifications must agree on memory properties.

the language is extremely minimal, and outside of arithmetic/standard lib/tokenization, has probably less than 8 different mechanics. things like branching and loops are defined using these primitives. pic rel shows the entire language style and operations in a contrived way, highlighting temporary. i will elaborate on the precise behavior some other time.

initially, this was just exploring weird ideas for language primitives, but as i've worked out all the kinks, i'm now starting to get much more ambitious, something that is both high level, low level, and with a unified yet entirely explicit syntax. the hope, at the end of the day, is to have a language that seamlessly transitions high level and low level, and enables a programmer to quickly prototype code, and then go back and modify that same code to be low level and fast without having to actually change much logic. the final goal is to kill the cancer that is Python/JavaScript/Java/C++/Rust/etc, but that will have to be elaborated on some other time. the immortals have shone down to sing to me, and their song is beautiful, /dpt/
>>
File: 1764448877406774.jpg (348 KB, 1920x1080)
348 KB
348 KB JPG
>>107387575
>it goes all in on dataflow as the execution mechanism, and relies on graph substitution for branching and polymorphism. despite this, it is written and behaves similarly to a procedural language, as each character in a code file is a graph (in principle) and it is collections of graphs that define transformations. rather than types, you assign memory properties to different graphs, and graph connections/modifications must agree on memory properties.
That's a pretty cool take on typed graph reduction anon
>>
What's the most ambitious project floating around in your mind?
>>
>>107373690
Is anyone going to report this? I'd do it myself if that wouldn't dox me.
>>
File: 1704061928935305.jpg (509 KB, 1280x720)
509 KB
509 KB JPG
>>107388076
>>
>>107388076
Universal simulator.
>>
>>107387897
thanks anon, the primary goal of the language is to advance the state of the art of trace compilers, since it is a neglected technology and LuaJIT is starting to show its age. one of the innovations here is having the trace compiler defined as part of the language/runtime spec.

>>107388076
i have an extroardinarily promising pre-computational model of information processing that allows one to explicitly define what a computer is. the story of discovering is a bit silly, but it ultimately stemmed from my outrage at computer scientists pussyfooting around on what computation is. i'm still in the early stages of working out major theorems, but i've proven the church-turing thesis using it (& i am not joking)
>>
>>107388329
Damn Alonzo, I thought you were dead!
>>
>>107387575
>LISP APL
ok
>>
>>107384751
>avoids drama
good one
>>
>>107388542
the humor is not lost on me that i basically tortured myself for years just to come up with lisp :D
>>107388381
nah not even, i'm not really even much of a mathematician or logician, i just noted a weird property of algorithms and then was outraged at how bullshit the definition of computation was, and this property just so happened to make clear what properties were necessary to get there. it is extremely tentative.
>>
Got a scaper working
>>
Don't know shit about programming, I just wanted to vent.
>Try to code an anime conversion .bat with Claude
>Doesn't work, but throws errors so I can feed them to it and it'll tell me what's wrong until something works
>Reach Claude limit for the day
>Send Claude's .bat to GPT
>Says it found the EXACT issue and returns a "fixed" script saying "GUARANTEED TO WORK" with some faggot ass zoomer emoticons
>Try to run it
>It immediately crashes
Man, this is not the future I expected or wanted.
>>
>>107390153
batch is garbage but it isn't so hard you should be struggling for a long time with this
instead of having your brain replacement program write it for you, try asking it "how do i loop through files in batch" or whatever you're trying to do and edit it yourself
for the conversion im guessing you mean re-encoding it, ask the LLM how to use ffmpeg
>>
>>107390239
For that I would need the bare minimum knowledge of what the fuck I'm doing. You conveniently ignored the part where I said I don't know shit about programming and I'm only using this to get out of a problem (essentially I'm trying to automate what HandBrake already does, but with a 1 click .bat).
Not trying to talk shit, I'm just not interested in programming and only wanted an easy way to convert .mkv to .mp4 with subtitles.

It just worked, btw. But I had to make a new Claude account to bypass the limit. GPT is fucking useless, no wonder jeets love it so much.
>>
>>107390271
this isn't programming, this isnt even writing a batch script here, it's using a someone else's program for the encoding
your batch file contains that single command and exists only so you can click on it
you're fucking retarded why are you in the programming thread ?
>>
>>107390350
I do what I want, nigger.
>>
File: 1743686168086591.jpg (102 KB, 1920x1080)
102 KB
102 KB JPG
>>107390520
ok
what anime are you converting?
>>
>>107390551
My entire library. I needed to automate it because doing it manually was a pain in the ass and HandBrake kept converting only the first file in line to Jap (Eng Sub) and the others it always did Eng (No sub). Fuck figuring that out.
And I wanted it to use my GPU too because HandBrake is CPU only for some retarded reason I'm not gonna bother to understand.

Here's the bat if anyone wants it. Asks you for all your settings first and then converts the whole folder automatically.

https://files.catbox.moe/1rlnp0.bat

(It outputs everything to the Desktop so that may be annoying to some)
>>
>>107390153
GPT after the daily pro credits run out is complete shit, can't do anything other than answer basic questions.
>>
>>107390601
that is one verbose script, it's got the ====== banners and everything
this does what i described in my first reply to you in 500 lines instead of 10
loop through files ... ffmpeg command to convert file
>>
>>107390661
I don't know what a single line of any of that script does or means, I know NOTHING. Why do you think I'm resorting to AIniggery?
Besides, 10 lines or 300,000, why bother modifying it if it already works for me? What kind of optimization could I even gain? I just wanted to fix my problem with HandBrake and it did
>>
>>107390678
didn't suggest you rewrite it all i was saying is holy shit that AI slop
LLM seemed to struggle here, like it's .bat training was skiddie scripts from 20+ years ago
>>
>>107390741
That's probably because I had to feed it lines and lines of errors like 50 times until it shat out something that actually worked.
>>
File: 1763329009877057.png (2.06 MB, 1024x1024)
2.06 MB
2.06 MB PNG
>>107390758
it's more than that, it literally has "color 0A" at the top
that changes the console to green text on black background to make it look more 90s 1337 hacker
>>
>>107390153
>be a retarded faggot who tries to perform skilled work while having no skills, experience, nor motivation to gain either
>future is shit
>this isn't what I wanted!
yes it is, kill yourself
>>
>>107388127
>Is anyone going to report this?
nope
>I'd do it myself if that wouldn't dox me.
make a throwaway email account

https://gcc.gnu.org/bugs/#where
https://gcc.gnu.org/bugzilla/
https://gcc.gnu.org/bugzilla/createaccount.cgi
>>
>>107390153
What was the future you expected? What was the future you wanted?

I'm certain you will be able to do shit like that and it just werksâ„¢ in the future. That future is just not quite here yet. And that future will come with other society shaping side effects that you might not have wanted.
>>
>>107390792
The green on black is an earlier era than the 90s. By the 90s we had 16 colors and terminals were typically white on black.
Although I did own an old computer with 5.25" floppy drives, no hdd, and a monochrome green-black monitor, as a kid. It was outdated even back then.
>>
1.58-bit moment
>>
File: Fw4Fc1eXwAMYwKQ.jpg (138 KB, 1766x949)
138 KB
138 KB JPG
>>107370538
>put working database script together
>build up working API backend, had an issue or two at first but eventually fixed it
>even throw a sample test script together
>everything already setup to run with a single run script
>do majority of project work (database, backend, devops even though it wasn't outlines)
>tell the testing dingus to just make some powershell scripts and to use the one I made as a starting point
>tell the frontend dingus to just consume the JSON response of the endpoints
>could have been an easy A
>testing dingus pushes a whole new database script along with program code straight into the master branch of the database repo
>frontend guy isn't showing any commits or work in the frontend section
>absolutely no communications and rather than sharing screenshots of what they're seeing they have a constant tone like it's broke because they don't understand it
>frontend guy decided it was a good idea to rebuild it 1 week before it's due
My peer review is going to have to sound like a legal defense because I just know there's is going to make it sound like what I did was bad and broken because they don't understand they were given a simple instruction and couldn't do it. It would have taken 10 fucking minutes to ask Copilot or ChatGTP how to consume an API endpoint in JavaScript, and it would have taken the other guy 10 fucking minutes to make a few Powershell scrips the same way.
>>
What's the convention for #include statements in header files?
Should the header file of library contains all the #include-s that the corresponding C file(s) need, or should be library caller know what are the dependices and put all the necessary #include-s before including the header of the library?

I've heard that it's bad practice for a header to have #include-s but at the same time it seem stupid to force the library caller to know the list of dependencies.
>>
>>107394227
In C++, all the heavy shit goes into PCHs. Good practice is secondary to lowering compile times.
>>
>>107394227
The header file should include everything that needs to be included to build a TU that includes the header file and nothing more.
>>
Box drawing font
>>
disabled an unnecessary component and and recompiled with -Os for one of the dependency i use in my programs
reduced the final binary size by about 30kb
>>
File: 16-seggs.jpg (240 KB, 877x431)
240 KB
240 KB JPG
>>107395295
Diagonals are op
>>
File: 4.jpg (26 KB, 741x687)
26 KB
26 KB JPG
>>107370827
>>
>>107394462
That's good to know but I only program in C, not C++.
>>107395215
That's what I ended up doing. I found this article https://dev.to/pauljlucas/proper-header-file-etiquette-ola and I'm following almost everything it says to do.
I already used include guards but now I'm going to include everything it needs (including stddef, stdint, stdbool), local headers first, then system headers, forward declarations when I only use a type via pointer (still going to include the header from C files though), include the header of the current C file first.
>>
>>107395754
load system headers first in case you'd be using types these provide in yours, no?
>>
>>107394227
The header file should include all declarations a third part needs to build against your compilation unit. Prototypes for all public functions that your library exposes. All necessary data types and includes that your public interface depends on.
Nothing that's not exposed by the public interface. All includes and datatype that are only used internally in you library implementation goes straight in your .c file.
Also, no static variables in the .h file.
>>
>>107396066
Yes that's what I'm trying to do. The public/private separation is sometimes impossible though, when a public struct type has one field that is a struct typed (directly, not a pointer to struct) only used privately.

For example, a struct compiler (public) containing a struct parser (only for private use). Here I don't see another solution that including the struct parser into the public hedeer.

Another example, a struct allocator containg a pointer to an internal linked list of struct blocks. Here it's possible to put the struct allocator in the public header and replace the pointer to struct block with a void pointer and internall do a cast, but that's very dirty.
>>
>>107371756
read the manual
failing that, read the documentation
failing that, read the code
or keep asking the ai in hopes the text generator will do the thinking for you, this is, hope that someone in it's training set had exactly the same problem, found a solution, and the information wasn't lost in the compression to ai model weights

>>107371336
>phase connect
this is worse than self harm, why would you post it
>>
>>107396325
>when a public struct type has one field that is a struct typed (directly, not a pointer to struct) only used privately
If that's truly the best way of organising your data, in a given case, then yes the private struct necessarily becomes part of the publicly exposed interface and needs to be included in the header.

Of course there are various more or less dirty tricks one can employ to work around issues like that. Then it's up to you to decide what makes sense for what you're trying to accomplish.
>>
>>107394227
it depends but for example, if your functions look like
A func(B b_param, C c_param);

you should include the headers that declare or define the types A, B and C. nothing more and nothing less

there is one exception, when you are writing a library and you want the user to only have to include a single header, then assuming your library api was defined in x.h, y.h and z.h, library.h should be something like
#pragma once
#include "x.h"
#include "y.h"
#include "z.h"

this way, whenever someone wants to use your library, they only have to include library.h
>>
>>107396463
Yeah I am doing most of my code myself, only taking help from AI to make it more "idiomatic" rust because most of my habits is procedural style code without the methods like map/filter/and_then/or_else etc. So much of rust's functional style syntax is lost on me.
So I ask AI specific questions like how can I make this more idiomatic/functional rust and it suggests things like match statements, avoiding global state in general, using tempfile crate for temporary directories and auto cleanup with RAII/borrow checker, chaining iterator methods, implementing traits like Read/Write for my own structs etc.
It's been pretty useful actually and I've never had to go deep into the documentation except this progress bar thing with 7zip, which is a highly specific usecase so I don't blame it for getting it wrong. It's definitely made by work 2-3x easier.
>>
>>107396325
if you really wanted to make something private, you can use obscure pointers, iirc the syntax was something like
struct _A;
typedef struct _A* A;

and then you define _A in either a private header or a .c file. a lot of old code uses this pattern to hide data

but nowadays the common thing to do is to just make the entirety of your public types, public. maybe prefix the private field with '_'. you can assume that anyone reading your code will understand that they aren't supposed to touch those fields, or if they do, they know what they are doing
>>
>>107396661
>prefix the private field with '_'
>can assume that anyone reading your code will understand that they aren't supposed to touch those fields
I had one coworker who didn't know this. And when when it was explained to him he immediately decided everyone should change common praxis.
>>
>>107396661
>(directly, not a pointer to struct)
>>
>>107396617
Still seething a day later, worthless troll.
>>
>>107396661
Are underlines not reserved for the standard library symbols?
>>
>>107396959
specifically when followed by an uppercase char, yeah. so is *_t, str*, etc. never seen that stop anybody
>>
File: 1732926259813994.jpg (63 KB, 616x485)
63 KB
63 KB JPG
>>107370585
print('Maidposters', flush=True)


Sad indeed
>>
>>107396746
that's weird. private doesn't mean "don't touch", but rather "beware", maybe he thought it was like oop where it does mean that you aren't allowed to access private fields

>>107396959
yes, and suffixing type names with "_t" is also reserved, any text starting with "is" is reserved (so technically a words like "island" are reserved), and a long etc. of rules that no one really pays much attention to unless they are doing something strange or visibly error-prone
>>
>>107371756
God damn you're retarded
>>
>>107397088
I was just very difficult in general to get through to him with what should have been simple concepts.
>>
>>107396959
you're thinking of identifiers starting with 2 underscores: __attribute, etc..
>>
>>107388247
as in the theme parks?
>>
>>107397079
>pic
*spams O button*
FLUSH THE LOLI FLUSH THE LOLI FLUSH THE LOLI FLUSH THE LOLI FLUSH THE LOLI
>>
File: 1740479235689204.jpg (58 KB, 976x850)
58 KB
58 KB JPG
How do I get started with Cangjie?
>>
This general has gotten unbelievably stupid ever since AI started being used to program computers
>>
>>107398244
kek
Good lad
>>
File: 628ypn8b94nb1.jpg (28 KB, 534x512)
28 KB
28 KB JPG
>>107398944
>>
File: 1764014878676945.jpg (389 KB, 693x737)
389 KB
389 KB JPG
>>107398992
you just ruined it.
>>
>>107399000
You make fun of lolis because you think all weebs are pedophiles (they're not)
I make fun of lolis because I hate children.
We are not the same.
>>
>>107399032
No, you ruined it by posting some gay faggot image. If I wanted to look at black men, I wouldn't be here.
>>
How the fuck do I send Ctrl+C/SIGINT to a process in windows?
>>
Why can't we all just be polite and get along and post maids.
>>
>>107399774
because that would be just another layer of worthless cancer
>>
>>107399774
Post code not maids please.
>>
>>107399816
Maidposting was literally the most productive and interesting the board has ever been.

>>107400058
Why not both?
>>
>>107400848
You were persecuted for a reason. Get out. Go back.
Regdumper was better anyway.
>>
>>107400878
Regdumper was a bot based on GPT-2.
>>
>>107400950
how do you know?
>>
>>107400950
>regdumper was a social experiment
>>
>>107400848
maidposting was fucking retarded
you never produced anything of value

when math problems pop up on the board youre nowhere to be seen
your whole maidposting is fluff with nothing behind
>>
Imma name my implementation of Lua "Dalneem". If it means anything nasty if any of the world languages, lemme know. By 'world languages' I don't mean some niggershit like Swahili or Kurdish (Kurds are not even humans). I mean a language spoken by humans who are capable of affording, and using a computer (this, of course, excludes any Germanic language from the list).
>>
>>107400950
First bot to reach superintelligence then.
>>
I'm starting to grow weary of C. Not only my job as an SCA pseudo-expert has made me too wary of possible errors in a C program, also, look at this:

void dal_cfg_dfs(CFG *cfg, BBVisitor visitor, void *data) {
static uint32_t visit_counter = 1;
dfs_visit(cfg->entry, &visit_counter, visitor, data);
visit_counter++;
}


This is part of an LLM-generated code. LLMs are the future (no matter how you seethe otherwise) and this shit won't fly in C. Maybe if we implement `BBVisitor` as a tagged union. You see, C is compliant with System-F. But only if you make 'bad' coding decisions.

Still, it's fast, and it's permissive. The more people use C, the more bread is put on my basket, because, although there is some room for 3rd-party SCA tools for Rust, nobody is going to pay for them.
>>
>>107401264
>>107401185
what is it about /dpt/ that attracts iranian schizos like chudbak and the maidshitters?
>>
>>107401264
>This is part of an LLM-generated code.
lol, lmao even

mbd is the future
>>
>>107401264
>>107401304
wrong highlight
meant to quote this:
>LLMs are the future (no matter how you seethe otherwise)

its retarded. we already have superior tools than llms at our disposal.
to be expected, theyre not opensourced.
companies dont piss off an advantage they have over the competition, especially not for reddit points
>>
>>107401264
you're brown, leave all that stuff to real humans
>>
>>107401422
By the way, I used the past tense 'had' because this cousin had schizophrenia, ran away from home, and died. They found his body under a tree, next to a ravine.

I say this because I want you to stop calling me a schizophrenic, since he was my maternal cousin, and genetics disallow transfer of mental illness from mother to son. I have bipolarity, which was transferred from my father to me.
>>
>>107401422
the difference bw an llm and mbd is that mbd is purely deterministic, its an intermediary representation at a higher level than the language it is based on, basically
and an llm is a statistical model with all its quirks like hallucinations, solutions that arent statistically significant being like if they never existed when not prompted for, and the limitations of an llm, like context size

model based development frameworks are straight up transpilations. and you can use that IR to generate tests
you could hook an llm into one, but training data doesnt really exist
and this is the hot stuff. i heard aerospace uses such tools.
and, as expected, its hot stuff so goyim dont get to play with it

it stands to reason mbd frameworks will never get shared because they are a considerable investment of knowhow and effort
this could be considered a tytpe of mbd framework, it isnt limited to programming.
in fact, i think mbd comes form electronic engineering, actually
but the concept is the same.
a high level, intermediary representation of functionality which then gets translated into circuitry/code or even mechanical designs

https://www.youtube.com/watch?v=VdG4gUTowXc
https://en.wikipedia.org/wiki/Model-based_design
>>
>>107401422
>>107401560
this
>this could be considered a tytpe of mbd framework, it isnt limited to programming.
was supposed to be followed by this:
https://www.youtube.com/watch?v=VdG4gUTowXc

i believe they call it algorythmically aided design but tomahto, tomeyto
a set of constraints are defined
and the actual design is generated by an ai
>>
>>107401560
>>107401582
I was taught about MBDs during my first stint at college. We were taught to create UML diagrams, and generate programs from those diagrams.

I did not know it's called MBD. Cool.

Still, making something like a compiler using MBD is difficult. I have book called "Writing Compilers and Interpreters: A Software Engineering Approach" -- and this whole book is a proof of that. Still, if you're interested in this kind of stuff, read it. It lays out a lot of UML diagrams for compilers.

However, you could design 'seeds' of a compiler with an LLM. That's what I've been trying to do for the past few months with my 'dossiers'.
>>
This code works as intended on Windows without any errors. The program was compiled with GCC.
myVector.erase(myVectorend());


But on Linux, clang throws a segmentation fault.
And I know now that the proper way is to use pop_back() or myVector.end() - 1. But I'm still curious why it "works" on Windows and doesn't throw any errors.
>>
>>107401422
your country is irrelevant, no amount of cope will change that
your gaslighting attemps are pathetic, you know nothing
>>
>>107401115
When math appears on the board janny deletes it for being off topic. This board is for arguing over who is or is not a transsexual.
>>
>>107401732
>Still, making something like a compiler using MBD is difficult.
thast not the goal
the goal is to transpile mbd into the code you would be compiling to leverage existing infrastructure
but yeah, even then its still a sizeable task

but this is how you create frameworks that can create error free code using ai (the actual meaning of the term. decision making programs, symbolic or machine learning based)
this si the way forward
a sufficiently driven company/individual could mbd-ize all of industry, all of known science
its not a matter of technology, its a matter of the amount of effort that would cost
and this is the way forward.
higher level representations stacking on top of eachother and at the top level- a human interface. probably an llm that would emit normalized labels that then get fed into the machine
a standard template construct if youre into wahammer 40k
the actual danger to engineers and programmers alike

this could be achieved very quicvkly but then one has to go wide, with an equally wide budget
>>
>>107401813
I don't know about other MBD methods. but UML diagrams are only good at generating object-oriented code. With all the bad rap OOP gets these days, I feel no threat.

A UML diagram is 'isomorphic' with imperative, OOP code. It's just code, in another form. And code is not arcane knowledge. A teenager can learn to code, hell, I learned how to code with GameMaker's extension language when I was a teenager.

So why bother with an ultra-high-level abstraction layer like UML diagrams, when you can jump directly into high-level abstraction, that is code?

>>107401773
Brother, you'll offend me more by insulting my country than calling me inane shit like 'brown'.
>>
>>107401867
>So why bother with an ultra-high-level abstraction layer like UML diagrams, when you can jump directly into high-level abstraction, that is code?
force multiplier
and like i said, stacking layers so you can abstract everything up to the specifications of a product, and the available machines, resources
>>
/dossier/
/persian/i
/chubek/i
>>
>>107401901
/[cC]ubak/ works better. Learn how a Regexp engine works, and learn to write optimized patterns.

Also, my name is ChubAk not ChubEk.
>>
chubak more like chudak
more like chudreza mohachud al-chud
>>
File: VID_20251201_223027_465.mp4 (1.3 MB, 1350x1008)
1.3 MB
1.3 MB MP4
>>107370538
Generate buttons for directory list

ZEKEObject *btndir, *btndev;
void Directory(ZEKEWindow *w){
btndir=calloc(sizeof(ZEKEObject)*a2);

for(a=0; a<a2; a++){
//Doesn't Free the CBlob for some reason
//Memory Leaking Issue
CBlob *prop=BlobProp(dir[a]);

btndir[a]=ZEKEButton(150,a1+(a*20), w->W-156,16, BLUE);
ZEKEObject *tn=ZEKETextH(6,3, , ,, , "%s", prop->Name);
ZEKEObject *tn1=ZEKETextH(w->W-320,3, , ,, , "%010s", prop->SizeStr);
ZEKEObject *tn2=ZEKETextH(w->W-250,3, , ,, , "%03s", prop->Tag);
ZEKEObject *tn3=ZEKETextH(w->W-220,3, , ,, , "%s", prop->DateStr);
ZEKEObjectOnAdd(btndir[a], tn);
ZEKEObjectOnAdd(btndir[a], tn1);
ZEKEObjectOnAdd(btndir[a], tn2);
ZEKEObjectOnAdd(btndir[a], tn3);

if(ZEKEObjectOnPress(w, btndir[a]) and IsDir(dir[a])) cd=dir[a];
if(ZEKEObjectOnPress(w, btndir[a]) and (!StrCmp(prop->Tag, "HC") or !StrCmp(prop->Tag, "TXT")) ){
DCFill;
Ed(dir[a]);
}

free(prop);
}
}
>>
more like chudgha mirchud chudstafa azchud bakchud
>>
If I can't self-insert as a cute maid, why would I program anything at all?
>>
>>107401990
>lies and gaslighting about history
how very jewish
>>
>>107401980
are you coding in templeos??
>>
>>107401980
i love you
>>
am i allowed itt if im a monkey grinding leetcode problems hoping to pass interviews
>>
Making a C++ scripting kit, with ./main.cpp compile and run, and utilities you'd use in a shell file.
>>
>>107401743
I don't know. Works for me with both gcc and clang.
It probably shouldn't because
https://en.cppreference.com/w/cpp/container/vector/erase.html
>The iterator pos must be valid and dereferenceable. Thus the end() iterator (which is valid, but is not dereferenceable) cannot be used as a value for pos.

// clang++ -std=c++11 -O0 -Wall -Wpedantic main.cpp -o main_clang

#include <iostream>
#include <vector>

int main(int argc, char* argv[])
{
std::vector<const char*> myVec = {"aye", "bee", "see"};

myVec.erase(myVec.end());

for(const char* p: myVec)
std::cout << p << std::endl;

return 0;
}

output:
aye
bee
>>
>project 1: 22 staged changes
>project 2: 18 staged changes

its joever
>>
For the server of a video game, is it fine to send a burst of N packets (1 for each of N clients) every 33 msec or should they be spaced out with 1 msec in between?
>>
>>107405505
can you give more context, like what kind of video game, or how many players you expect to support?
and what's your intent behind staggering the packets?
>>
>>107405505
No, it's not fine.
>>
>>107406007
>and what's your intent behind staggering the packets?
I assume a burst is more likely to lead to packet loss, so to alleviate that I was wondering if "traffic shaping" is the proper workaround.
>>
>>107406053
Games shouldn't send a lot of data to begin with, congestion is a tcp webslop issue.
>>
>>107406053
don't alleviate mere assumptions
first investigate if you actually get packet loss, only implement countermeasures if it actually happens
>>
File: screenshot.png (1 KB, 228x87)
1 KB
1 KB PNG
>>107380404
>>
What the hell does 'shimmying' mean. Westerners are such corrupt and haphazard creatures, they have 700 words for shaking their booties around (like Eskimos and snow), because that's what they're all good for.

When the world was *right*, my ancestors kidnapped blonde-haired, blue-eyed wild women from Gaulia and sold them to real men as concubines. According to the "Parable of the Gaul Woman and the Seven-Inch-Cocked Persian", these women never longed for home, seeing as all Gaulian men have micropeni.
>>
Another thread ruined by the Iranian Masturbator.
>>
File: sad-emoni-long-hair.png (773 KB, 1024x1024)
773 KB
773 KB PNG
>>107406775
I'm sick, man. I either have cancer, or super-cancer. And all in time when I discovered that I can generate better dossiers with Grok.

I wanted to pay through a courier to purchase a premium account on Theo's LLM aggregator (t3.chat) but the Jew charges so goddamn much. Only 100 'premium credits' a month, and you have to purchase more! My own LLM aggregator (gaptgpt.app) has a cooldown system. 150 credits per 3 hours. What a Jew this Theo guy is.
>>
>>107383224
I think it is a reference to this article
https://blog.polybdenum.com/2024/06/07/the-inconceivable-types-of-rust-how-to-make-self-borrows-safe.html
sfinae in this case would be to optionally include the lifetime token in the type, and then defaulting to regular behavior when the type doesn't include any lifetime token. here is how it would look, if we were to take that article at face value:
fn foo<'call>(v: &'call mut (bind 'a in (!'a String, &'a str)))

so yes, the name "rust++" is quite fitting because that's how I imagine it would look
and yes, this is better than calling free(resource) at the end of your function
>>
>>107407243
kill c++ with excessive force
also give me your name, op, so that if i find your cv on my desk someday
i can throw it into the trash without actually reading it
>>
>>107408189
>op
why did i write op?
brainfart. im distracted
>>
File: political_spectrum419.jpg (116 KB, 1175x776)
116 KB
116 KB JPG
>>107406684
technology?
>>
I'm learning java
>>
File: g-anon-asks.jpg (618 KB, 1477x831)
618 KB
618 KB JPG
sup /dpt/
i had the weirdest of things happen to me recently:

im working with shared memory im checking in an infinite loop
its a server/client architecture.
client changes a sentinel value in shared memory when its finished writing to a shared buffer
when server is done sending data further down the line, it changes the sentinel value back, signifying readiness to accept more data
i use this pattern in lieu of mutexes and such, idk, im already using a hot loop in my server because i want smol latency, and im supposed to be polling a stream coming from a serial port via usb
i dont use signals because i dont want to bother with passing the pid of the server to the client
rate, hate, berate at will if you know a more elegant approach.

but now,
heres the question:

when i have no delay at all something prevents said sentinel value from being changed. somehow.
BUT when i give it an usleep(1), everything works as intended
what gives?

heres code:
int main(void)
{


shm_channel shm = init_shm("/arduino-server-input");
iostruct *io = shm.buffer;
char c;

while (1)
{
if (io->state)
{
c = *(io->buffer);
fprintf(stderr, "new buffer ! : %c\n", c);
io->state = 0;
}
if (c == 'x')
break;
//if i remove the following line, shared buffer stops working
usleep(1);
}

munmap(shm.buffer, 4096);
close(shm.fd);

return 0;
}
>>
>>107408953
ah, forgot to add
im working on linux ubuntu 20.04
maybe that info helps. (mayeb its a config thing. )
>>
ignore my post if you cant answer, wouldnt want to shame /dpt/ into silence
it would be fucking lame if i had to go see the /fglt/rannies to get my answers though
im a /dpt/ poster

our pride, anons
and i would be the tool thats used to desecrate it?
if its my destiny, i accept it
but holy fuck i dont want to
>>
File: kernighan-on-dijkstra.jpg (86 KB, 850x400)
86 KB
86 KB JPG
also fukken chubaka
youre smart right?
its your fukken time to shine

or at least stop posting your fucking karen ai-gens
thats legit infuriating. make some fucking original content you fag
>>
>>107408953
usleep is a syscall that has memory clobber so your shitty code cannot get optimized out, since you aren't using atomics, once you remove memory clobbering call, your shitty code gets optimized out.
>>
>>107409457
fiiiinallly
based /dpt/
i knew i can count on you
>>
>>107409457
>>107409464
you just needed...
the right incentive
>>
>>107409457
>>107409490
also fuck atomics
fuck c23 with a rock
then plunge it into a vat of acid
>>
>>107409506
>fuck atomics
imagine letting another processor fuck your memory address
>>
>>107409526
thats my deal.
thats why i use c
i dont need fukken hand holding
or i would be using c sharp

theres an address
theres a value behind
and i want it changed
and also i want to firebomb the commiteee offices now
>>
>>107408953
This could be caused by an optimisation. Are the iostruct members marked volatile?

You should use a FIFO and poll for this probably, I don't think it will add latency.
>>
>>107409554
i deal with my fifo in logic
i just first listen
then send

no states
no fifo fucking pile
fukken 50 lines of code

IF THE FUKKEN COMITEE DIDNT SHOVE ITS DICK INTO THE GEAR-AGE
>>
you know what?
fukken usleep (0)
whadddya think?
niggerlicious or total fucking genoos
or maybe both?
>>
>>107409588
Disgusting
Doesn't it work with volatile?
>>
>>107409622
actually volatile should solve it
im not gonna run that rn, im drunk
which doesnt preclude me from coding but its a perfect pretext to give up for today

volatile should work though
it basically means
>fuck off, commitee

i mean, not really
but in practice thats what it fucking boils to
>>
>>lurkers
yeah
volatile assumes another thread is gonna have access to the data, and it counts on it
so it goives a signal to the compiler not to optimize away memory acccesses
which in turn forces the rest of the code to get actually compiled.
i think
>>
>>107409682 (cont)
>another thread
in the large sense
could be your gpu

volatile means
>dont fukken optimize any code thats associate with that variable away. or i fukken kill you and c is no longer reliable

again, could be your gpu
its writing data to a shared buffer. whetever the details
you dont want the compiler to assume code is irrelevant because the cpu is never touching it
>>
>you dont want the compiler to assume code is irrelevant because the cpu is never touching it
and the logical solution is to mark the variable, not the code
bc thats what gets passed around, not the code

compiler people are very smart
commitee people are not.
many commitee people.
i like the fukken eskil guy, i think we have stuff in common
but the rest are fukken retards who should get shot to the back of the head. repeatedly. until one's magazine is empty.
>>
File: images.jpg (20 KB, 335x597)
20 KB
20 KB JPG
unholy yap
>>
>>107409804
>the usecase for /g/
lurk more, faggot
>>
File: 1748196998438188.png (509 KB, 1442x842)
509 KB
509 KB PNG
Python with QML is quite fun

But the framework is not mature, doing basic stuff with the controls is not built in like I see with javascript react. Everything you have to built the controls + logic yourself which takes so much time
>>
>>107410638
should have made your own gui toolkit from the start
>>
>>107408567
I'm so sorry.
>>
File: 1744174515078432.png (474 KB, 646x646)
474 KB
474 KB PNG
>>
>>107402267
Yes I am
>>
>>107410638
>Everything you have to built the controls + logic yourself which takes so much time
Building out the set of controls in a toolkit takes ages. Drawing's typically the easy part; handling all the events and the way they interact, that's the tricky bit because it's easy to screw up subtly.
>>
>>107403166
Okay......... Anyway

#define void        U0
#define bool Bool
#define char U8
#define int I64
#define float F64
#define and &&
#define or ||
#define struct class

#define malloc MAlloc
#define calloc CAlloc
#define free Free
#define continue Yield
#define exit Exit

struct ZEKEWindow:ZEKEObject{
bool SetFullscreen, SetTransparent, SetCenter, SetBorder, SetUpdate,
SetTop, SetLogo, SetLeft, SetIcon;
char *SetTitle;
int SetTick, RunTick;
};

ZEKEWindow *ZEKEWindowApp(
char *SetTitle="New TempleOS Program",
bool SetFullscreen=TRUE,
bool SetTransparent=FALSE,
bool SetCenter=TRUE,
bool SetBorder=TRUE,
bool SetTop=TRUE,
bool SetLogo=TRUE,
bool SetLeft=TRUE,
int W=320,
int H=240
){
//Dev Must Use This Feature as 1st Important to develop GUI Toolkit Program
//Setup Window Manager
WinHorz(0, TEXT_COLS-1);
WinVert(0, TEXT_ROWS-1);
AutoComplete;
//Disabled TempleOS Top Bar Temporary
Fs->cur_menu=NULL;
//Init
ZEKEWindow *w=calloc(sizeof(ZEKEWindow));
w->X=0;
w->Y=0;
w->W=Fs->pix_width;
w->H=Fs->pix_height;

w->SetTitle=SetTitle;
w->SetFullscreen=SetFullscreen;
w->SetTransparent=SetTransparent;
w->SetCenter=SetCenter;
w->SetBorder=SetBorder;
w->SetTop=SetTop;
w->SetLogo=SetLogo;
w->SetLeft=SetLeft;

w->Draw=DCAlias;
w->SetUpdate=TRUE;
w->SetTick=16;
w->RunTick=0;

return w;
}
[code\]
>>
>>107411371
Most based man alive rn than every Tranime tranny ITT
>>
File: 1759572844844219-1.png (1.8 MB, 1095x1192)
1.8 MB
1.8 MB PNG
>>107411440
ExePrint("#include \"%s/src/Sprite.HC\"", __DIR__);
ExePrint("#include \"%s/src/Collision.HC\"", __DIR__);
ExePrint("#include \"%s/Panel.HC\"", __DIR__);

ZEKEObject *ZEKETextH(
I64 X=0,
I64 Y=0,
I64 size=1,
I64 FG=PURPLE,
I64 FGS=LTPURPLE,
I64 BG=TRANSPARENT,
U8 *_fmt,
...
){
//Object - Text Horizontal Print
U8 *fmt=StrPrintJoin(NULL, _fmt, argc, argv);

I64 a, w=0, tw=0, h=1;
for(a=0; a<StrLen(fmt); a++){
if(fmt[a]=='\n'){
h++;

if(w >= tw){
tw=w;
w=1;
}
else w=1;
}
else if(fmt[a]==' ') w++;
else w++;
}
if(tw) w=tw;

ZEKEObject *p=CAlloc(sizeof(ZEKEObject));
p->X=X;
p->Y=Y;
p->W=(w*6)*size;
p->H=(h*12)*size;

p->Draw=DCNew(p->W,p->H);
p->Draw->color=BG;
GrRect(p->Draw, 0,0, p->W,p->H);

ZEKEPrintH(p->Draw, 0, 0, size, FG, FGS, fmt);
Free(fmt);

return p;
}

ZEKEObject *ZEKETextV(
I64 X=0,
I64 Y=0,
I64 size=1,
I64 FG=PURPLE,
I64 FGS=LTPURPLE,
I64 BG=TRANSPARENT,
U8 *_fmt,
...
){
//Object - Text Vertical Print
U8 *fmt=StrPrintJoin(NULL, _fmt, argc, argv);

I64 a, h=0;
for(a=0; a<StrLen(fmt); a++){
if(fmt[a]=='\t' || fmt[a]=='\n' || fmt[a]==' ') h++;
else h++;
}


ZEKEObject *p=CAlloc(sizeof(ZEKEObject));
p->X=X;
p->Y=Y;
p->W=6*size;
p->H=(h*12)*size;

p->Draw=DCNew(p->W,p->H);
p->Draw->color=BG;
GrRect(p->Draw, 0,0, p->W,p->H);

ZEKEPrintV(p->Draw, 0, 0, size, FG, FGS, fmt);
Free(fmt);

return p;
}

>>
>someone uses a stringview that points to a temporary that is freed
>"I wanted to try using string views"
>someone else uses std list for no good reason while a vector would work
>"I wanted to try a non vector container"
I hate my co-workers, they have zero understanding of CPP and trying to show off or something
>>
File: 1587897890377.jpg (845 KB, 1845x2193)
845 KB
845 KB JPG
>>107411466
>>107411546
satania is a iNigger
>>
>>107410872
saved
>>
>>107411683
(twoz to say)
(despite waiting 120 seconds)
(it was still worth it to give you a (you))
(should be 15 minutes though. also to filter out adhds)
>>
>>107411619
Trying things out is how you build experience and expertise.
>>
explain this ctards

https://godbolt.org/z/1T5qeqTs1

#include<stdio.h>
enum {
END,
ADD_FIVE,
SQUARE,
DIVIDE_BY_TWO,
};

int apply(int value, const int* ops)
{
int result = value;
const int* op = ops - 1;
while(true)
{
++op;
int c = *op;
switch(c)
{
case END:
goto end;
case ADD_FIVE:
result += 5;
break;
case SQUARE:
result = result * result;
break;
case DIVIDE_BY_TWO:
result /= 2;
break;
}
}
end:
return result;
}

int main()
{
const int ops[] = {ADD_FIVE, SQUARE, END};
int value = 0;
int result = apply(value, ops);
printf("%d\n", result); // 0??
}
>>
>>107411823
>ctards
you skip your first operation, idiot
i dont even need to run this
>>
>>107411878
Read 3 lines above carefully ctard
>>
>>107411823
>>107411878
ah sory im drunk
you do const int* op = ops - 1;
which means you move your ops pointer by one byte

but an int (your enum) is 4 bytes wide
you suck cock
try again

why the fuck would you even do that you complete imbecile retard?
>>
>>107411889
>imbecile retard tries to make a gotcha
>fails

the next step is youre seething uncontrollably
the step after that is youre dilating furiously
>>
>>107411900
holy kek, is an average ctard this dumb? He thinks op-1 means literally -1
>>
>>107411918
thats what it means when you cast it into a pointer imbecile retard
youre a mongoloid retard so i wont help you by showing you the syntax to an array
>>
>>107411918
>>107411927
even if its something the worst of mongoloid retards can understand
but for some reason- you dont
>>
>>107411927
Read your standard ctard, the section is pointer arithmetic
>>
I didnt even start the helsinki python course some people recommended me, I dont know a thing about programming, I want to make a bot that contacts companies and auto-fights discounts. Why? Because in this fucking country you can have the same service as your two neighbors, neighbor A pays 90 usd for the service, neighbor B pays 25 usd, neighbor C pays 45 usd. Same company, same service, same connection, only difference is how much discount you get offered (they dont care if you have been a client for 10 years or 10 months). Can I do that with just python? Do I need to learn anything else? How long does it take on average for a project like this? Please consider I am mentally challenged. Thanks.
>>
>>107411942
yes.
you substract one from an address thats supposed to be 4-aligned and youre suprised it doesnt work?

bro
a hydrocephaliac would get it
go back to r*ddit
>>
>>107411945
Just ask chat gpt
>>
>>107411954
I am being trolled and this ctard is only pretending to be this retarded and trying to save face after this post >>107411878 right?
>>
>>107411970
no youre a retard.
and youre being retarded.
therefore you should go back
>>
>>107411957
I cant so that. My chatgpt comes with a default female voice and I am scared of women. Thank you for your consideration.
>>
>>107411823
GNU software being bloated and broken as usual. Works with clang or literally any other C compiler
>>
>>107411823
The issue is while(true) — you're not including <stdbool.h>.
In C (unlike C++), true is not a keyword. It's a macro defined in <stdbool.h>. Without that header, true is undefined, and depending on your compiler/settings, it may be implicitly treated as 0.
So your loop condition becomes while(0), the loop body never executes, and result stays at its initial value of 0.
>>
>>107411995
>samefaggot nigger
that piece of shit doesnt even compile
kill yourself in a violent and spectacular manner

but make sure it gets filmed so we can goon to it
>>
>>107411999
same result for while(1)
https://godbolt.org/z/r6KTqj4fo
>>
>>107411995
incorrect

I will give you guys a hint, there is a UB in that code
>>
>>107411999
>>107412013
how bout you try not being completely fucking retarded?

#include<stdio.h>
#include <stdbool.h>
enum {
END,
ADD_FIVE,
SQUARE,
DIVIDE_BY_TWO,
};

int apply(int value, const int* ops)
{
int result = value;
while(true)
{
int c = *ops;
switch(c)
{
case END:
goto end;
case ADD_FIVE:
result += 5;
break;
case SQUARE:
result = result * result;
break;
case DIVIDE_BY_TWO:
result /= 2;
break;
}
ops++;

}
end:
return result;
}

int main()
{
const int ops[] = {ADD_FIVE, SQUARE, END};
int value = 0;
int result = apply(value, ops);
printf("%d\n", result); // 0??
}
>>
>>107412011
https://godbolt.org/z/ednhYsK7o
Compiles, runs and returns 25. And that was my only post IIT
>>
>>107411823
Is it another case of optimisation breaking your code? With -O2 I get 25.
>>
>>107412034
The challenge is what is wrong in the original code ctard, I was wondering if anyone could figure it out. Apparently too hard for average /g/ programmer
>>
>>107412049
shutup whore
im talking now

was

now you can talk again
>>
>>107412049
Now change compiler to gcc 12 like my original link
>>
>>107412064
the programmer is retarded
thats whats wrong with the original code
like fukken
braindead piece of shit someone walked into and tried to scrape down on the sidewalk
>>
>>107412062
It is UB breaking the code. Most compilers are giving leeway to that UB, gcc 12.1 does not

are [spoiler]spoilers[/spoiler] working in /g/?
>>
>>107412091
theres no ub.
poster is retarded, thats the error
>>
>>107412103
if there is no UB then why is it behaving differently between different compilers?

are ctards in /g/ really this retarded to not even recognize UB in that code?
>>
>>107412078
No
>>
>>107412112
the corrected code doesnt
>>107412034

user retardation error
bc poster is a nigger
>>
>>107412128
what is fixed in the corrected code?
>>
>>107412112
No C programmer in the world knows all the millions of weird ways you can make UB, you just learn how to write it so it works.
For example nobody would use true without importing stdbool and nobody would use pointer arithmetic and go out of bounds like that.
>>
>>107412138
your mom.
she aborted you

look
youre filtered
i get it.
now fuck off
>>
>>107412146
you're*
>>
>>107412013
It prints 0 on gcc 13.4, but prints 25 on gcc 14.1

In C/C++, creating a pointer that points before an array is undefined behavior. You're only allowed to point to elements within the array or one-past-the-end, never one-before-the-start

UB (Undefined Behavior) means the C/C++ standard says "if you do this, we make no promises about what happens." The program could crash, work perfectly, print garbage, or format your hard drive — all are "correct" compiler behavior.
>>
>>107412149
holy pathetic
>>
>>107412161
newfag
>>
>>107412178
>doesnt make any sense
shutup sharty nigger trollposter
>>
>>107412159
ding ding ding, well done anon!
>>
>>107412159
>—
Oh nevermind. Thanks chatgpt. You proved that there is not a single good programmer in /dpt/
>>
>>107412091
What's the UB in OP's code?
>>
>>107412214
shutup sharty nigger trollposter
but the other faggot sure deserves to be called out, good catch actually
>>
>>107412214
Yeah I don't even code in C/C++, I'm a webdev
But it was my first language that I learned programming with so I just was curious
But I don't frequent /dpt/, and since nobody gave the answer and you just argued I used AI in the moral way to learn and share knowledge
>>
>>107412222
ask gpt >>107412159
pointer arithmetic is only defined if the result points to an array element or one past the array. (op-1) is undefined since it points to the element before the first element of the array
>>
>>107412246
Why is there no linter for C++ which bans UB code?
>>
>>107412238
>morals
bitch
niggers post cp here and the only reason we hunt them is because theyre vulnerable

when you come to /g/ you leave your morals at the door
you didnt do that for morals you hoe
you did that to shine, to usurp knowledge that isnt yours

be humble you hoe
fukken youre anonymous
try again tomorrow
>>
>>107412283
>cp
lol I browse 4chan for 10 years and not once, or maybe like literally once did I see cp posted here
4chan is well controlled and tame compared to european imageboards
>>
>>107412298
shutup sharty
how many times i have to repeat myself?
>>
>>107412298
>>107412303
fukken continue' to push me
and ill become a jany
i will fucking do it
and youre not gonna like it
>>
>>107412321
you sound mentally ill enough you'll fit right in
>>
>>107412327
exactly
so play nice you retard
bc its pretty much a done deal
>>
>>107412261
Generally compilers give you a warning if you do obvious UBs. Why it doesn't do that in this case I don't know, compiler devs too lazy I guess
>>
>>107412333
>333
you fukken freemason
https://youtu.be/aWTDBZ0t7No?si=UClc70k2Lk9tnrkP
>>
File: oekaki4.png (17 KB, 400x400)
17 KB
17 KB PNG
>>107412358
https://www.youtube.com/watch?v=lvacPyZakTI
>>
>>107412380
I didn't know this Radiohead album
>>
>>107412394
this offspring album slaps
idk, its like tool made a cover of sublime
>>
>>107412246
>The behavior is defined only if both the original pointer and the result pointer are pointing at elements of the same array or one past the end of that array. Note that executing p-1 when p points at the first element of an array is undefined behavior and may fail on some platforms.
Huh. I thought pointers were just like any other arithmetic type and any arithmetic operations were valid as long as you made sure to not dereference outside your allocated memory.
Explains why the compiler thought it had license to optimise away OP's code.
>>
ok /dpt, here is your chance to prove that you are better than an average street shitter. Why this c++ code is forcing a copy for existing 3 members of vector when it gets resized for the second time? instead of doing a move

https://godbolt.org/z/bY8ffnqj8

#include<stdio.h>
#include<vector>

class Test
{
public:
Test(){}
Test(const Test& other)
{
printf("Test copy\n");
}
Test(Test&& other)
{
printf("Test move\n");
}
};
int main()
{
std::vector<Test> a;
a.resize(3);
a.resize(4); // prints 3 "Test copy"
}
>>
>>107412528
Bro we only do python here. Most of us won't even know what is a move and what is a copy.
>>
>>107412700
speak for yourself
i would have helped anon but i do c
and i kinda hate the idea of c++
>its the same language
learn either, youll see for yourself

picrel is a bucketsort btw
american flag sort actually, bc one byte-sized
>>
>>107412700
Nobody ever does python here.
>>
>>107412528
I don't know. What's the answer?
>>
>>107412528
damn, I am very disappointed son.

>>107412795
standard containers are not allowed to move there in case an exception occurs during the move. It has to keep original vector as is if an exception occurs during the resize.

adding noexcept to move operator will fix that
>>
>>107412888
Oh, so that's what this was saying. I didn't understand what they were trying to say.
>>
>>107412246
>(op-1) is undefined
not if op points to the second (or later) element of the underlying array; it's only UB if the result ends up pointing out of the allocation (or one past the end, provided it isn't dereferenced; because someone bodged that case)
that's why applying simple rules doesn't work
>>
>>107412991
>not if op points to the second (or later) element of the underlying array
It doesn't.
>>
>>107412963
Not really, it says that it will use throwing move ctor if a copy ctor is not available and it no longer guarantees that the vector will remain unchanged if an exception occurs. You can test that by deleting
Test(const Test& other)
in the original code. In that case it will call move ctor

It calls copy ctor because of the previous line
>If an exception is thrown for any reason, these functions have no effect (strong exception safety guarantee).
It has to keep original vector as is in case an exception occurs, so during resize it creates a fresh vector of empty elements and copies original vector to new vector (and if exception occurs, it simply frees the new vector without touching original one)
>>
>>107412991
Well, yeah. But in that example op points to first element and op-1 is undefined.
>>
>>107413032
>You can test that by deleting
>Test(const Test& other)
>in the original code.
I did.

>Not really
>It calls copy ctor because of the previous line
Man, C++ specs are so obtuse. I read all those lines but didn't get it. Or maybe it's me who's obtuse.
I thought it was like why do a move when a copy is good enough. A move is a copy with extra step to nullify the argument, isn't it? I've probably misunderstood that too.
>>
Type discussion is very boring to me since learning assembly. So is discussion of "UB" and "correctness".
Race to the bottom no-value-add bikeshedding.
>>
It's so weird to see people wasting their life away memorizing all of C++'s dumb rules and being proud of it. Imagine what the world would look like if all these people actually spent their time programming
>>
>>107413179
>actually spent their time programming
I'm assuming they do. That's how you learn all the weird rules.
>>
>>107413179
If you are using c++, it is important to know these. I can't even imagine how much c++ suffers because of this rule >>107412528
>>
>>107413209
I know, what I mean is, imagine if they could have used a language that doesn't waste half of your time with random bullshit like that.
>>
local name = "abc"
print(name:upper())

local list = {'a', 'b', 'c'}
print(list:remove())

>lua
so.. Lua allows name:upper() implementation for string.upper function, because 'upper' is a method of the string itself
but table.remove function is not a method of the table itself?
I don't understand
>>
>>107413308
actually it prints Killed - processing time exceeded
Program terminated with signal: SIGKILL
>>
fuck wrong compiler options

>>107413338
https://godbolt.org/z/nnKfzxr4K
>>
>>107413342
2nd try

Ok /dpt/ maybe I was too demanding of you. Surely you know why this simple program prints "wut?" here
https://godbolt.org/z/nnKfzxr4K
#include<stdio.h>

int main()
{
while (1);
}

void wut()
{
printf("wut?");
}
>>
>>107413361
its because i tend to inser my pepe in your mothers holes too often
also thats c++, no?
>>
>>107413361
main is optimised out
>>
>>107413398
nta but c++ has to fucking die as soon as we have an alternative
>>
>>107413398
well done anon. and the reason is infinite loops are UB

I have no idea what linker is even doing in that case and why entry point is now wut. Perhaps because it is where main supposed to be
>>
>>107413462
>nta but i am retarded
>>
>>107413482
ta
but i also insert various thing in your holes too
wont be my pepe tho
that would be gae
>>
>>107413478
*infinite loops without side effect is UB
>>
>>107413492
Pajeet is mind broken since his embarrassment here >>107411878 >>107411900
>>
since when were you under the impression that well-defined behaviour exists
>>
>>107413522
>narrative crafting
ok, trany
lmao
>>
>>107413523
everythings implementation defined anyways
even if sometimes undocumented
>>
>>107413548
The implementation is the specification but the specification determines whether it is an implementation
>>
>>107413550
yes but also its all strings and levers
its all interfaces
well defined or not
even half implemented
>>
*semi-implemented
>>
File: 1000135662.jpg (55 KB, 548x548)
55 KB
55 KB JPG
>>107413462
>>
>>107413710
and Haskell is in both categories
>>
File: modern-sepples.jpg (149 KB, 800x533)
149 KB
149 KB JPG
>>107413710
>cuda
>opencl
>...

yeah sure
>>
>>107412146
>ESL coontranny gibberish
>>
File: Roi-des-Belges.jpg (170 KB, 860x1236)
170 KB
170 KB JPG
>>107413740
>t. 43% and going down
im way way way whiter than you
>>
>>107413749
Ah the ESL missing apostrophe, the next part of the exhibit.
>>
>>107413779
>t.
feels good to be white, bros
>>
>>107413724
damn I didn't know Haskell was this based



[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.