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


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1654929570433.jpg (85 KB, 573x900)
85 KB
85 KB JPG
Old thread: >>93620154

What are you working on, /g/?
>>
File: hare.png (1.2 MB, 2500x2500)
1.2 MB
1.2 MB PNG
First for H A R E
H
A
R
E
The most based and redpilledl language.
>>
Reminding anons to use https://github.com/friendlyanon/cmake-init when creating new C++ and C projects!
>>
>>93662344
Why haven't you been permabanned yet?
>>
>>93662329
unironically based
>>
File: 1537995626144.png (612 KB, 899x677)
612 KB
612 KB PNG
>>93661886
>MFW don't know Python
>MFW it's the only language I know that can ez scrape websites
>Have to rely on ChatGPT to get the ball rolling
>MFW I don't read the documentation for the libraries I use
Anons, how much of a hack fraud am I? I can program in C and I'm pretty good with SQL queries but I feel like an absolute degenerate.
>>
rape
>>
Why do people on stackoverflow get on my case about "not using enough c++" when I'm writing c++? They keep trying to convince me to use vectors and strings and fstream, and all that bullshit. No, I'm not going to use strings or vectors if I don't need dynamic resizing. Every time, they tell me to use std::cout instead of printf, but std::cout looks like shit. And they tell me to use fstream instead of fopen and fread. Why? I don't need it and it blows up the binary size for no reason. Just because im programming in c++ doesn't mean I need to go out of my way to use all its features.
>>
>>93662706
you used the same bait two days ago
>>
>>93662706
show proof
>>
Is it just my lack of familiarity, or MSVC really is a nightmare to work with?
Lack of basic posix headers like unistd.h aside, I keep getting tripped by random gotcha's during compile and especially linking.
Is there a quick cheat sheet on things to look out for when writing C code for msvc?
>>
>>93663024
sounds pretty normal, if you came from gcc then you probably used a bunch of non-standard things. completing implementations were a mistake
>>
File: file.png (537 KB, 701x261)
537 KB
537 KB PNG
rate my random string generator /dpt/
>>
>>93662770
I brought it up in the past, I'm bringing it up here in the present, and I'll bring it up in the future as well, because it keeps goddamn happening.
>>
>>93663074
I'm not deviating from standard that much. Well I'm used to having posix functions at my disposal, but there are many other weird things to look out for, it seems.
Some are mostly harmless, like the stupid warnings for using standard functions like strcpy instead of the nobody-ever-uses-alternatives like strcpy_s.
Right now I'm having a headache linking my executable against a static library that is built during build (using cmake), which it refuses.
Looking up the error code led me to find out that the projects were being linked against different runtimes (/MT vs /MDd), but even forcibly setting (/MT) flag on both projects doesn't solve my issue.
I get undefined references to __imp_<library function name>
>>
File: file.png (190 KB, 939x495)
190 KB
190 KB PNG
Is this the coolest story you've ever read or what?
>>
>>93663200
>I'm not deviating from standard that much.
That is almost certainly what you think, but not the truth. A common problem amongst cnile cmen, and a large part of why you people are the butt of every joke among competent programmerfolk.
>>
>>93663024
It's supposed to work out of the box if you use cmake and vcpkg (and in theory it should work with system packages / self build libraries too, but some libraries aren't even made for cmake, like boost which vcpkg patches).
Also windows by default has pretty aggressive warnings, use _CRT_SECURE_NO_WARNINGS.
Any problems you have can be fixed by looking at what the generated commands from vcpkg has, and what your broken command makes (by making ninja show verbose output).
>>
>>93663105
C++ faggots are the updooooters of the programming world, only one level removed from rustfags or worse, js framework chasing abominations.
That said, c'isms in c++ have many disadvantages, including being sometimes slower (a popular example is that std::sort is WAY faster than qsort due to the ability to specialize and inline), less safe (std::cout vs fprint is a good example of this, so is std::string which can bound-check and doesn't degrade to a pointer like the abomination that are c strings), more verbose (except std::cout, that applies to basically everything here) and generally a bad choice for everything (however, fprint is well known to be much faster than std::cout, and if you need performant console stream IOs, you really should use the C primitives).
>>
>>93663024
always link dynamically to the standard libraries, never statically
too many issues with static linking and the windows dll runtimes
>>93663200
>Looking up the error code led me to find out that the projects were being linked against different runtimes (/MT vs /MDd), but even forcibly setting (/MT) flag on both projects doesn't solve my issue.
oh god those errors
so MSVC doesn't have a stable ABI or any form of ABI tagging so instead they intentionally embed linker command line options which compare the value of a macro constant in different binaries (which you can do via #pragma comment(linker, "option") for useful options like autolinking and though #pragma detect_mismatch which is what they're actually doing that makes libraries incompatible with each other)
there's certain combinations and orders of static and dynamic library linkage that are okay to link library to executable
>Some are mostly harmless, like the stupid warnings for using standard functions like strcpy instead of the nobody-ever-uses-alternatives like strcpy_s.
#define _CRT_SECURE_NO_WARNINGS

literally every one does this
also
#define _CRT_NONSTDC_NO_WARNINGS
to use POSIX names for POSIX functions (there's actually a fair amount of them)
>I get undefined references to __imp_<library function name>
this is caused by a function being compiled with dllimport that is actually statically linked so it finds the actual function and thinks it's the thunk and is still looking for the actual function or something like that
>>
Does YouTube have any download/upload limitations programmatically?
Like I have thousands of bookmarked videos and some get randomly deleted.
Thinking about making a script that downloads a video from the bookmarks export file, uploads it to my own YouTube account and sets it to private, deletes the local file to save space and then proceeds to do the same with the other bookmarked video urls... thousands of times I can backup all my favorite YouTube videos in my own account but set to private.
No way it would work right they probably have some download or upload limit and it isnt actually "free"?
What language would you use for this? Python?
>>
>>93663074
>if you came from gcc then you probably used a bunch of non-standard things
Such as?
>>
>>93663075
You can do better
>>
>>93663464
>compiled
*declared
static is the default, the attributes __declspec(dllexport) is for creating dynamic libraries and creates 2 symbols, __declspec(dllimport) is for consuming dynamic libraries and consumes those 2 symbols (or __attribute__(((dllexport/dllimport))) if you're using gcc/clang and want to use the GNU form)
the .lib file associated with dynamic libraries is the import file and will be produced automatically when using __declspec(dllexport) and merely maps filename to symbol name
you can also make dynamic libraries using an export definition file and a static library
and i can't remember if the normal windows toolchain has a tool for making import libraries to existing dynamic libraries (it's probably just buried in LINK.EXE somewhere, all the windows binutils are actually just shims to the linker) but mingw and llvm's windows toolchain have it, it's called dlltool/llvm-dlltool
this isn't that important for normal workflow stuff but more for hacky shit, for example if you want use AMD CUDA on windows the normal way (single fat binary) instead of like opencl (runtime compilation)

also you will want to be using the clang MSVC toolchain instead of the microsoft MSVC toolchain
it is 99% compatible with MSVC and the MSVC ABI with a few weird edge cases like clang not accepting some of what MSVC considers valid structured exception handling filters
just better in general, more conformant (has full support for atomics for example), better performance, and has things like GNU language extensions
it can ship with MSVC installed through visual studio though typically that version is out of date and you need to edit MSBUILD or cmake into using your custom one
>>
>>93663602
computed goto is a common one. Case range (...) is also common but you probably don't know that one. Anything with attribute or inline asm of course. #pragma (especially #pragma once) is nonstandard but supported everywhere, so you should use it anyway. zero-length arrays and empty va_args also come to mind.
>>
>>93663075
the generator is probably stateful, the distribution you are using (uniform int) is not, though it could be if it were a different one, so you wouldn't want to just create them over and over like that unless you know it's going to be the uniform one

random device may or may not be stateful idk
>>
>>93663537
for the downloading part at least you could use python plus the yt_dlp library. I've done similar stuff before, except without the uploading part after.
I have to ask, why not just store these locally or at least on a google drive/the internet archive? If they got deleted from another channel, there's always a chance they could get deleted from yours too.
>>
What does a Stringbuilder do in java in simple language? And why is a String used in the for each loop condition for String array, how does that work?
>>
>>93664066
>What does a Stringbuilder do in java in simple language?
afaik if you're going to be concatenating the string, stringbuilder is faster/more efficient than a regular string because stringbuilders are mutable while regular strings are constants.
>>
>>93663690
i had something useful i wanted to start post #3 off with but i can't remember my original point
structured exception handling = C exception hangling, which is buiilt into the OS and is what windows uses instead of signals for some things
also another benefit to using clang-cl over the microsoft cl is clang-cl supports inline asm, including both gnu and microsoft's inline asm dialect on 64-bit targets
i think i was once able to solve a mssing ___imp_ error using either clang-cl's support for asm aliases or for gnu language extensions on windows like weak symbols

oh and windows finds headers and static/import libraries through environment variables called INCLUDE and LIB which work just PATH does (on windows the seperator is ; and path is also used for finding dynamic libraries alongside executables)
the "dev prompt" is just a console session that runs a batch file/powershell module that sets up those environment variables and then some
>>
>>93664066
>What does a Stringbuilder do in java in simple language
it uses a char array to represent the string and uses special allocation logic so that it only reallocs when space is needed, whereas actual strings are forced to realloc on every change.
>why is a String used in the for each loop condition for String array
foreach loops don't have conditions, you just provide a variable to assign each value to. the string isn't being used for a condition, it's being used to get the value of each string from the array.
this is assuming you mean this:
String[] ss = { "One", "Two", "Three" };
for (String s : ss) {}
>>
>>93663075
which bitmap font
>>
In C, what is the thought process behind using "safe" types? i.e., using size_t for array indexing, uint_x when you know the max size of a variable, etc. How is this safer?
>>
>>93664456
C does not have type safety at all. Also you should avoid using unsigned types whenever possible because they are a common cause of insidious bugs.
>>
>>93664465
Aren't signed ints worse because overflow is technically undefined?
>>
>>93664590
no
>>
>>93664465
Look man, I'm getting spastically bombarded by SOers saying I should always specify the size of the variables and that I should avoid using long/char/int/etc because the size of these types will depend on the machine.
I think it's largely BS but I also don't have the experience to say for sure.
>>
>>93664465
Honestly I prefer unsigned types because when there's a bug in your code they tend to fail fatally whereas signed types can hide bugs.
>>
>>9366406
if you're adding characters to a string bit by bit it makes new storage for all the old ones + the new ones only to throw that away when you add even more
the idea behind stringbuilder is that it's cheaper to ask for storage in bulk ahead of time and throw away the extra instead of bit by bit
>And why is a String used in the for each loop condition for String array, how does that work?
an array is just a sequential (one after another) region of memory in a straight line with a start and end
a string array is a sequence of strings (which are themselves sequences of characters with extra features (and characters are just numbers))
you need to step element by element through sequential data to do anything with it all
the elements of a string array are strings
the element of a string are characters
the loop does the stepping

i really genuiely don't think programming is for you if you're struggling with things like this, i've seen your posts over the last few /dpt/s and you seem very confused about very rudimentary stuff
>>
>>93664669
I wouldn't blame him too much, it sounds like he's following one of those shitty intro to Java tutorials that is just "here's how to do X in Java" one after the other.
>>
>>93664663
example of code crashing with unsigned variables and don't crash with signed variables?
>>
did webdev general is dead?
>>
>>93664663
I've never seen a numerical problem fail due to unsigned. The opposite: you write an innocent loop going from max to 0 and it ends up being an endless loop because your number (defined elsewhere) was unsigned so it rolled over, or you did a (destructive) subtraction and the same happened or you forgot to reorder your numbers so the small one was the second...
And often you can't get answers from printing (we're assuming you don't recall the var is unsigned) because the bits are correct, it's just their interpretation that's wrong, so your printout looks just fine but it also tells you that "-1 > 2? True".
Signed has none of these problems and anytime the limit of the int matters, it means you're in a specialized case and you're already acutely aware that this may be an issue anyway.
Assuming you do the right thing and never use crap like ints of size other than 32 and 64 for general purpose computation anyway (they're slower or equal to using 32 bit but are once again more error prone).
>>
>>93664590
yes but everything implicitly converts so you can only do so much to combat it
>>
>>93664776
I hope so. I also hope it stays that way.
>>
>>93664612
they're just typedefs, but you gain nothing from variable length compiler defined sizes and you can easily fuck up using them
feel free to shorten them
in using particular, size_t, uintptr_t, and intptr_t should always be used when dealing with anything memory related since they're tied to the bit-width of your platform, and you need this literally all the time
you shouldn't be writing compiler and platform specifoc code for something like that, i mean do you know what compilers and ABIs size_t is defined as unsigned long long int vs unsigned long int off the top of your head and do you want to write an ifdef to check at every use?
the others aren't as important but should still be used because it's better to be explicit than to not be

as for floating point, float and double are IEEE single and double on everything that matters so they're safe to use directly
there's multiple 16 bit floating point formats in comon use but the compiler type that would correspond to float and double is usually __half
long double isn't on the other hand
it's 80 bits on some platforms, 80 bits but aligned to 128 on others, and 128 bits on others
>>
>>93664890
is it 80 bits on anything x64? feel like those days are long gone
>>
>>93664751
taking array index -1
>>
>>93664751
I was actually drafting this up after I made that reply
char input = '\0';
int i;
// This value should never be less than 0
int num_times_to_print = 0;

while (input != 'q') {
scanf("%c", &input);

if (input == 'u') {
++num_times_to_print;
} else if (input == 'd') {
// Here we should be checking if num_times_to_print is already 0, but we're not
--num_times_to_print;
}

// This won't crash if num_times_to_print goes below 0,
// but it would if num_times_to_print were unsigned
for (i = 0; i < num_times_to_print; ++i) {
printf("\nHello World");
}
}

>>93664837
>you write an innocent loop going from max to 0 and it ends up being an endless loop because your number (defined elsewhere) was unsigned so it rolled over, or you did a (destructive) subtraction and the same happened or you forgot to reorder your numbers so the small one was the second...
But doesn't this prove my point? A common symptom of bad unsigned usage is infinite loops... which will probably cause a fatal error. And even if you're not using loops, the fact that your program is suddenly dealing with numbers that are hundreds of millions times bigger than what you were expecting will probably tip you off to where the problem is anyway.
>
And often you can't get answers from printing (we're assuming you don't recall the var is unsigned) because the bits are correct, it's just their interpretation that's wrong, so your printout looks just fine but it also tells you that "-1 > 2? True".
Now this is a good point, I hadn't considered that
>>
REEEEE
The bug I've been working on for a few nights straight is in Microshit's fucking XInput library
>>
File: bug.jpg (17 KB, 600x600)
17 KB
17 KB JPG
>>93665002
>>
>>93664695
oh yea
i hadn't even considered how much bad java material must be out there compared to other langs
i had a proper course in it and even that was pretty light on details and focused more on memorizing APIs
can't imagine what wading through all the shit out there to learn java is like, finding good c++ books for myself was hard enough
>>
>>93664938
>But doesn't this prove my point? A common symptom of bad unsigned usage is infinite loops... which will probably cause a fatal error. And even if you're not using loops, the fact that your program is suddenly dealing with numbers that are hundreds of millions times bigger than what you were expecting will probably tip you off to where the problem is anyway.
The infinite loop problem will not happen if you use signed types. Instead, the loop will operate exactly like you expected at best, and if not (e.g. in the case where it doesn't run at all), the problem is very easy to debug, see, and understand (partly because normal numbers are signed so you inherently have a better intuitive understanding of them -- remember, in this example you don't have the type declaration in your face).
>your program is suddenly dealing with numbers that are hundreds of millions times bigger than what you were expecting
Then the signed will alert you before the unsigned and both will function the same for all intents and purposes.
Therefore, unsigned is a mistake in any case. In fact chances are that if you're dealing with numbers that big, instead of going from signed to unsigned, you really want to switch to a bignum lib.

Turns out that maybe java was right to not have unsigned.
>>
>>93664695
>>93665040
Why the fuck would someone try to learn programming basics through Java??
>>
>>93665081
Ser do not redeem the job DO NOT REDEEM IT SER I know the java benchod are you a prostitute? Do not redeem the job! Need job for to save of the village with the needful!
>>
>>93664913
think it still is on msvc
if you really need to you can get 128 bit floating point using the llvm project's (experimental?) support for the x64-windows-itanium triplet, i think
>>
>>93665081
In my experience (the USA) most places use Java as the introductory programming language
>>
>>93663292
Pretty cool
>>
>>93664395
terminus
>>93663967
hmmm, does it matter if this is stateful or not?
>>
>>93661886
total X death pasta script. (two inputs - main noun and alternate noun. ex `./total nigger black` generates TND)
#!/bin/sh
echo Kill $1s. Behead $1s. Roundhouse kick a $1 into the concrete. Slam dunk a $1 baby into the trashcan. \
Crucify filthy $2s. Defecate in a $1s food. Launch $1s into the sun. Stir fry $1s in a wok. Toss $1s into \
active volcanoes. Urinate into a $1s gas tank. Judo throw $1s into a wood chipper. Twist $1s heads off. \
Report $1s to the IRS. Ka$1e chop $1s in half. Curb stomp pregnant $2 $1s. Trap $1s in quicksand. Crush $1s \
in the trash compactor. Liquefy $1s in a vat of acid. Eat $1s. Dissect $1s. Exterminate $1s in the gas \
chamber. Stomp $1 skulls with steel toed boots. Cremate $1s in the oven. Lobotomize $1s. Mandatory \
abortions for $1s. Grind $1 fetuses in the garbage disposal. Drown $1s in fried chicken grease. Vaporize \
$1s with a ray gun. Kick old $1s down the stairs. Feed $1s to alligators. Slice $1s with a katana.
>>
>>93665352
not really unless you want even distribution over multiple calls to it

the random device tho idk much about
>>
>>93664921
-1 would be a big ass unsigned number though, it would definitely segfaults every time
>>93664938
I was recently bit in the ass by signedness but it was the opposite situation.
>https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious
>Find the log base 2 of an integer with the MSB N set in O(N) operations (the obvious way)
Here, using int instead of an unsigned int (for the variable r) and causes an infinite loop in this code. (or at least a slight variant of it). sar vs shr instruction
unsigned int v; // 32-bit word to find the log base 2 of
unsigned int r = 0; // r will be lg(v)
while (v >>= 1) // unroll for more speed...
{
r++;
}
>>
File: file.png (460 KB, 1105x1083)
460 KB
460 KB PNG
Why is anyone even remotely related to sourcehut, drew devault, plan 9, fediverse, neocities, or any of that shit, always, 100% of the time, a troon? Genuine question. Software has gone to shit since 2005 or so, and, in the past 5-10 years, at an extremely accelerated rate to the point even normalfags are now pissed about the absolute state of mainstream tech like google search.
At the exact same time, everywhere I look, it's troons troons troons everywhere.
What kind of fucked up conspiracy caused troons to take over all of software and also ruin it for everyone at the same time? And how can one escape the madhouse?
>>
>>93665832
because low level programming talent is closely associated with mental illness.
>>
>>93665939
I've heard that many times but when I explored this thesis, I encoutered the following contrary evidence:
- Virtually every single low-level project with a troon was started by a non-troon
- The non-troon was typically succeeded by more non-troons for years
- Finally a troon ends up taking over when the project is long done/established
- Invariably the software starts losing features and becoming buggy/slow when that happens
Although sometimes there are some people that develop a software for years or even decades and then suddenly troon out, I know of only 1 case so far and he hadn't really touched his software in years before trooning out.
Therefore, I find no evidence on my end that this is true. Do you have any other document (studies?) to substantiate your claim?
>>
>>93665832
>drew devault
I thought he was calling out troons in one of his recent articles?
>>
File: file.png (263 KB, 927x526)
263 KB
263 KB PNG
>>93666083
How? 3/8 hare maintainers are troons and even more across sourcehut and hare contributors: >>93662329
He fucking LOVES troons. Also pic related.
>>
>>93666019
I'm a zoomer and I have mental illness I am pretty sure.
older generations got beaten up for standing out and not following the norms.
>>
>>93665939
>low level programming
>mental illness
that non sense, low level programming projects are hard and require smart people (heterosexual white males with a CS degree)
>>
>>93666109
>pic related.
ah my mistake, I didn't paid attention and though it was a nerdy girl, but of course it wasn't
I guess that the hare spam threads make sense now, it's what troons do
>>
>>93666162
when I say mental illness I don't only mean the lgbt group.
programmers are strangely political, and divided like politics, both extremes having their own brain rot.
>>
>>93666162
To be fair that's not the case, and professional low level programmers (including embedded in such areas as space and military) are typically some of the worst programmers in existence.
>>
>>93666215
Programmers were the most anti-political people you'd ever see up to about 2010 in my experience both observing from outside and actually interacting with them on both a professional and amateur basis. The only clans that were allowed were those relating to using tech X or style Y or language A or OS B.
>>
>>93665002
>>93665008
for future reference, Ltrigger and Rtrigger don't work right.
>>
>>93664850
you want them to come here?
>>
>>93666273
No, I want them to go back to redd!t from whence they cam.e
>>
>>93666292
ok I'm staying here
>>
>>93664890
>you shouldn't be writing compiler and platform specifoc code for something like that
Yeah, it's completely irrelevant to the code I'm writing. I don't want to add a layer of obfuscation if it only serves to have other programmers ask further questions, if that makes sense.
>>
Trying to improve software quality by increasing the amount of testing is like trying to lose weight by weighing yourself more often. What you eat before you step onto the scale determines how much you will weigh, and the software-development techniques you use determine how many errors testing will find.

-- Steve McConnell
>>
>>93666612
testing helps you maintain software quality, not necessarily improve it...

what a dullard quote
>>
>>93666612
also you're fat and your code is full of bugs, fatty
>>
>>93666612
based and correct
testers btfo
>>
>>93664663
failing loudly is underrated
>>
>>93666627
>>93666633
Wasn't this directed at management that wanted a new way of telling programmers how to program while adding new metrics for tracking progress? That is, it isn't an objection to testing, it's an objection to HPCs convincing management that test-driven design will solve all of their tech-debt related problems.
>>
>>93667220
I don't know or care it is simply someone else's opinion
>>
>fail easy problems leetcode
>code appears to be completely fine
>conclude that there is a bug in leetcode and move on
it's nothing personal
>>
>>93666192
you mean that's what the kfarmers and sharties do who made and spammed in those threads
>>
> Maven
> <pluginExecution>
> <pluginExecutionFilter>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-jar-plugin</artifactId>
> <versionRange>3.1.2</versionRange>
> <goals>
> <goal>test-jar</goal>
> </goals>
> </pluginExecutionFilter>
> <action>
> <ignore></ignore>
> </action>
> </pluginExecution>

> jar names
> org.apache.maven.plugins:maven-checkstyle-plugin:maven-plugin:3.1.2:runtime

> Can't lock dependencies for child plugins without committing die

Jesus christ kill me know i hate spark i want to go back to python send help i hate maven
>>
>>93668859
Haskell this doesn't have problem
>>
>>93668859
Dotnet does not have this problem.
>>
File: 1685089980317.jpg (435 KB, 872x835)
435 KB
435 KB JPG
>>93668243
>>
>>93661886
How do you store/document your functions/methods for future use?
I have a dozen of small scripts for everyday use, but some were written 4 years ago, so I completely forgot the code. But every now and then, when I write new stuff I get this "I wrote this before"-moment, and start to look through old files. I created a COM-object, which I import to my new scripts, but I wanted to get other opinions.
>>
>>93669361
i simply dont

if i need something from before i just open the old project and copy it and adjust as needed, simple as. note that (presumably) unlike you, i work on a project-to-project basis
>>
>>93669361
I make my own library? Most programmers do this at some point in time.
>>
Why do i have to loop through a whole string just to find a special character? Why can't there be a function that lets me find the count of a special character? Who wrote this fucking crap, its so redundant.
 for (int i = 0; i < str.length(); i++)
>>
>>93669570
sis, your filter...
>>
>>93669570
what language
>>
What does ?i mean as a special construct?
>>
>>93669570
>Why can't there be a function that lets me find the count of a special character?
filter and length
"abc##$".filter!(c => c == '#')
.count
.writeln; // 2
>>
i have 83k lines of AI generated code to measure
>>
TypeError: 'zip' object is not subscriptable

IF ITERTOOLS.ISLICE EXISTS
THEN WHY NOT FUCKING BIND IT TO THE NORMAL SLICE SYNTAX
I get that iterators have better memory performance but why do they have to be so goddamn inconvenient? Half the time you still have to wrap everything in list() to do anything useful.
>>
File: 1670326903664095.png (101 KB, 3796x1825)
101 KB
101 KB PNG
oh wait i did this long ago
>>
>>93663998
I just assumed the user who uploaded them deleted the video.
I dont see why Youtube would remove it if its private. I dont have enough storage its probably like 2tb worth of videos. I guess I could look into the cloud if its cheap.
>>
>>93663464
>>93663690
I finally managed to do it.
So, not only you have to tell the library that you are building it statically, the project that is linking it must also declare the appropriate macro...
what a headache.
>>
>>93661886
https://github.com/timothyericsson/CanYouHackMe/

Made a simple DVWA/HackTheBox style site.

I don't have any tech friends, can someone let me know what they think?
>>
>>93666627
Anon... how could you misread the quote so badly?
>>
>>93671649
What does this measure exactly?
>>
So can an FP chad explain why:
lend amount balance = let reserve    = 100
newBalance = balance - amount
in if balance < reserve
then Nothing
else Just newBalance


is better than:

public int lend (int amount, int balance) {
final int reserve = 100;
final int newBalance = balance - amount;
return newBalance < reserve ? 0 : newBalance;
}


Haskell is more verbose and why is it returning Nothing instead of 0? This is from the learn Haskell guide

https://book.realworldhaskell.org/read/defining-types-streamlining-functions.html#deftypes.locals
>>
>>93671649
Extraterrestrial chads rise UP!
>>
The disciple went up to Gargi Yagnyavalka and offered the sage the customary salute.

``Teacher'', he asked, ``can you explain to me the secrets of pure managers? I have been a student of the Indian software industry for many years but I am unable to understand the role that pure managers played. My heart is now troubled, and I am unable to sleep at night. I have now begun seeing visions of tessaracts spinning in 4-space and my dreams are full of strings vibrating in Calabi-Yau spaces.''

The sage put down the CD-ROM twirling on his finger and looked at the student over the rims of his spectacles.

``Very well'', said Gargi, looking at the earnest young man in front of him. ``First, let us review some definitions.''

``What is a Pure Manager?''

``A manager who manages a team without having a clue about the work that the team does'', said the novice.

``Good. And what is a deliverable?''

``Something of value to a customer, O Sage'', replied the young man.

``Is a status report a deliverable?''

``No, O sage. A computer cannot execute a status report.''

``And what about a Quality Plan?''

``O sage, a Quality Plan in itself also has little value to the customer.''

``So what is a deliverable, then?'', asked the sage.

``Something the customer can use, to serve his need. A working program, perhaps'', answered the novice.

``Good'', the sage was pleased. ``Now, in a project managed by a Pure Manager, who determines the progress of the project?''

``The people working in the team, O sire'', replied the novice, ``for the pure manager, by definition, cannot determine the correctness of any course of action, since he hath no clue about the merits of one path over the other.''

``So what does the Pure Manager bring to the project team?'', asked the sage.

The disciple was silent.
>>
>>93665048
>Turns out that maybe java was right to not have unsigned.
maybe? not having it has fucked the language
whenever I have to deal with unsigned bytes I have to have a function "turning" it to unsigned, but it's actually a short
I HATE the antichrist
>>
>>93669570
>Who wrote this fucking crap, its so redundant.
I love how you make it sound like having to loop through a string to find a character was an arbitrary decision by the language designers and not just a basic logical conclusion of how that data needs to be interacted with.
>>
>>93672666
>I HATE the antichrist
>>
>>93672241
it's not more verbose, you chose to indent it after =, there's less code overall
it returns Nothing to signal failure, the other lend does not tell you if lending failed, you could have 100 and lend 100 successfully
>>
>>93672767
Of course there is nothing about the second function that isn't also functional, it's just a different language.
>>
>>93672801
FP is more than just using immutable values.
>>
>>93672872
No but it's literally a pure function, if the logic of that function was what you wanted you would use it. There's nothing unfunctional about it, I have already explained the reasoning you might return Nothing and Just instead, but if that didn't apply you might want the second and would write it.
>>
>>93672872
>output functionally dependent on input
>no side effects
It's by definition purely functional
>>
>>93672896
>There's nothing unfunctional about it,
It lacks context to possible problems like the other anon said.
0 could mean a multitude of things, whereas Nothing is concrete in what happened relative to the context.
Also the issue with non-FP langs and trying to be "Pure" is it's entirely on the programmer to enforce it. Which will eventually fall apart given enough complexity.
And i only know of unpopular langs outside of ML's that actually have compiler enforced purity.
>>93672956
As I said, non-compiler enforced purity is garbage.
>>
>>93672666
Why would it be a short?
Why don't you use bespoke primitives to do that instead of doing java-only hacks?
PEBCAK.
>>
>>93673467
>PEBCAK
cringe
>>
Whats the regex to replace spaces between two letters with a dot in java?
>>
>>93673785
([a-zA-Z])\s+([a-zA-Z])
\1.\2
>>
>>93673785
In Perl this is just
s/(?<=\w) (?=\w)/./
>>
>>93673785
which scene group are you with?
>>
File: file.png (7 KB, 608x291)
7 KB
7 KB PNG
is there a way I can simplify the bitwise validations?
>>
What does sequential and parallel aggregate operations mean? I need to understand the documentation I'm reading.
>>
>>93672716
Having to deal with low-level crap is a language issue though.
>>
I finally get why everyone always says there should be a blank line at the end of your file. It's not actually a blank line, it's just consistent use of the line feed throughout the entire file and text engines just render a new line (obviously) despite it actually being the 'same' line
text on a lineLF
text on a lineLF


text on a line
text on a line

>>
>>93674076
I don't think programming is for you buddy
>>
>>93674076
>iterating through a string in a loop is low-level
lmao, what is low-level for you as well? I need a laugh
>>
Trying to convert an integer programming solution I wrote to a constraint satisfaction problem into ASP with Clingo but it times out when trying to solve, and I can't seem to get optimization working in Clingo. Constraint Logic programming is most definitely a based paradigm and very fun to wrap your head around but I can see why everybody in operations research fields uses Gurobi...
>>
>>93674502
Having to manually code bug prone loops just to find a single character is by definition low level crap that should have been safely abstracted away by the language especially when we have ChatGPT out there already able to do it with ease.
>>
>>93674598
That's mostly just a C family issue anon.
other langs have longed fixed that with array literals and iterator sugar
>>
>>93674598
>bug prone
this has been solved for literally more than half a century
if you don't know how to iterate through a string to find a char (the most basic question), computer science isn't for you and you should dropout
>>
today on /dpt/, someone complains that the language doesn't contain a function they could write themselves in 3 lines of code
>>
>>93674598
int countOf(String str, char ch) {
int sum = 0;
for (int i = 0; i < str.length(); ++i) {
if (str.charAt(i) == ch) {
++sum;
}
}
return sum;
}

The time you spent complaining about this could have been spent writing, unit-testing, and deploying this single function twenty times over.
>>
>>93674699
Reminds me of this article https://www.davidhaney.io/npm-left-pad-have-we-forgotten-how-to-program/
>>
According to most formatters, the correct way to indent those codes are:

doSomething(
parameter1,
parameter2
).then(() => {
// this piece of code will have one level of indentation
});

// or

doSomething(
parameter1,
parameter2
)
.then(() => {
// this piece of code will have two levels of indentation
});


I don't like either, first one is cramped, and second one adds an ugly level of indentation for no reason.
Wish I could do like the second one, but without the extra tab. It makes more sense

doSomething(
parameter1,
parameter2
)
.then(() => {
// this piece of code will have one level of indentation
});
>>
File: 1677452653840177.jpg (32 KB, 435x431)
32 KB
32 KB JPG
Why are I/O combined in Haskell? If purity is concerned with determinism, output should be pure because it's fully deterministic. If purity is concerned with modification of state, input should be pure because it doesn't modify anything. Even if purity requires both, why combine them? Why not a separate input monad and output monad?
>>
Wow he's now advanced enough to have opinions on styling. Good for him, good for him.
>>
>>93673929
auto os::wait_for_data_on_fd() -> bool


why are you writing your function signatures like this
>>
>>93674892
the cult of sepples demands all """"""""""""""""""""""""""""""""''modern"""""""""""""""""""""""""""""""""""' code do it
>>
How do you return the highest and smallest number in a string in java?
>>
File: 1685115022806.png (602 KB, 856x659)
602 KB
602 KB PNG
>>93661886
Is it true that std::shared_ptr's overhead is minimal?
>>
>>93669570
you don't. learn to use higher order functions you fucking retard
std::count(str.begin(), str.end(), 'c');
>>
>>93674929
I love how C++ looks completely different depending on what era the programmer learned it in. I didn't even recognize that code was C++ at first until I started reading it.
>>
>>93674856
because they're inherently connected things.
>yeah time to listen for keyboard input and then do nothing with it lmao
>today i will magically spawn some output with no input :^)
>>
>We tested this hypothesis by macro-benchmarking a version of memcmp that is specifically optimized for code size (only 2 icache lines) and locality.
>In short, it only special-cases very small string sizes (to aid the compiler in inlining very fast cases) and falls back to rep cmps for larger compares.
>Even though it achieves slightly lower throughput numbers than the glibc version in microbenchmarks, this simple proof-of-concept is a net performance gain.
>On large-footprint workloads like websearch, it reduced cycles in memcmp more than twofold and showed an overall 0.5%-1% end-to-end performance improvement.
Ha. I always advocated for using a small and simple approach to memory copy, comparison and scanning using the Intel repeated string instructions.
>b-but cmpsb and scasb are le slow!
Glibc niggers with their gigantic bloatware strlen and memcpy fucking BTFO.
https://storage.googleapis.com/pub-tools-public-publication-data/pdf/e52f61fd2c51e8962305120548581efacbc06ffc.pdf
>>
>>93675007
just wait until Herb starts pushing cppfront harder too.
>>
My software has no I/O. Its inner functional workings are so miraculous that it contains business value and of itself.
>>
>>93675007
type deduction is honestly one of the biggest cancers in the language. the auto keyword was a god damn mistake.
a tool which was convenient in very limited circumstances ended up being abused to no end. now you have people who unironically write code like this
auto i = int{1};


i fucking hate this stupid language so much. not even for its complexity, but for the simple fact that the standards committee has been bending over backwards adding new and terrible ways to abuse the auto keyword because postfix manifest typing is trendy rather than add useful features that we've been clamoring for for YEARS.

it's 2023 and we still don't have semantics for compile-time reflection on data structures. instead we have curly brace initializers for primitives because if the language was lacking anything, it was redundant semantics for basic shit.
>>
>>93675026
Sounds like bullshit. I implemented both a vectorized and 'dumb' version for my own experiments when programming in asm, and the vectorized version was WAY faster especially on larger workloads.
>>
Why doesn't Rust simply let you write

#include <lib.h>


to automatically generate bindings and configure linking?

Would that be so hard for the trannies to implement?
>>
>>93675290
not a problem in D
https://dlang.org/spec/importc.html
>>
>>93675392
Not a problem in chicken scheme
https://wiki.call-cc.org/eggref/5/lazy-ffi
>>
File: ClipboardImage.png (12 KB, 646x501)
12 KB
12 KB PNG
>>93675267
Did you read the paper? It says that complex vectorized versions are faster in microbenchmarks (i.e. you have a loop that runs memcpy 100000 times) but slower in the real world if the vectorized version is hugely bloated.
By the way, I suspect (have no data to back it up though) that simple, "read only" functions like strlen, memchr, etc. can be implemented with better performance using SSE2. For example, Agner fog's strlen code is not bloated, it's relatively easy to understand, and is probably faster than scasb for most short strings and especially so for long ones.
On the other hand, glibc's memcpy is an abomination, extremely cache unfriendly and rep movsb is definitely gonna do better than that (especially since we now have ERMSB since Ivy Bridge, and FSRM since tiger lake or whatever).
>>
is GCC and Clang better than MSVC compiler? In such measures as
>features
>builtin functions and intrinsic
>optimizing
>error and warning mnemonics
>>
>>93675018
>because they're inherently connected things
that's not a good reason to combine them. folding isn't baked into the list type. addition isn't baked into the subtraction operator. they are distinct concepts and should have their own distinct types because they signal completely different things. by separating them out, i can glean if a function performs one or the other by its signature and explicitly declare my own function's operations in the same way. very little input can coincide with a lot of output operations, like in an update cycle. and vice versa, a draw cycle performs a great many input operations with very few output operations. if they were as tightly linked as you imagine them to be, this kind of disparity wouldn't be conceptually possible.

>yeah time to listen for keyboard input and then do nothing with it lmao
reading from any file once, such as configurations during initialization
>today i will magically spawn some output with no input :^)
yeah, i do this all the time. signalling program state via shared pages or /tmp

"because I can't imagine the usecase" is such a non-answer
>>
>>93661886
How long should it be expected to memorize all the regex for a programming language?
>>
>>93675290
>rust doesn't have a text replacement preprocessor
lol
>>
>>93675558
that depends on the language
>>
File: 1546136738468.jpg (271 KB, 777x759)
271 KB
271 KB JPG
>>93674856
>output is pure
No. For a function to be pure, you need it to return the same result for the same input. Consider something like LocalDateTime.now() or Random.nextInt(). That takes nothing/unit as an argument every time, but every subsequent call returns a different value

>input is pure
Not always. You can use a nondeterministic function as input.

You can probably have them separate and define something that combines them, but that's just extra effort. The point of IO is to to mark and contain something that might be nondeterministic.

The purpose of that is that so when you evaluate and create the instance of the IO you sort of decouple it from the rest of the "universe": that particular instance is deterministic (if it doesn't mutate state outside its scope), it can only ever be evaluated in a single way, and it will always be evaluated in the same way, but if it is nondeterministic you will not be able to ever create a new identical instance of it.

There was a retarded comic floating around the board a while back saying that you pass the universe as an argument to the program, that's what it's refering to, for that single instance if you were to take a snapshot of existence and run it exactly the same, you would have a separate identical instance of IO that would behave in the same way.

All in all the confusion around monads/IO stem from the retarded analogies people create to explain them, and there's a lot of them floating around.
>>
>>93675535
>reading from any file once
you're getting output from the file read
>>
>>93674892
why not?

trailing return types are good, for short type names like bool though it's not necessary, but not unwelcome.

Get with the program, grandpa!
>>
>>93675599
>Consider something like LocalDateTime.now() or Random.nextInt(). That takes nothing/unit as an argument every time, but every subsequent call returns a different value
Wouldn't that be input from the perspective of the program? Input to say "I got this from the outside", Output to say "I'm writing this to the outside". Reading a file vs writing it.

I can see what you're saying though. It's a trade-off to keep the implementation simpler. Just cram both of them in the oracle and call it a day.
>>
>>93674982
according to Facebook guy at cppcon, yes.

The real answer is it depends on your application, if you're doing HFT and need sub 1 microsecond then no they are bad, but for most everything else they are great.
>>
>>93675843
>Wouldn't that be input from the perspective of the program?
Everything is input from the perspective of the program, but that's not really the point. It's not input from the perspective of the programmer, which is the important thing.
>>
I would be willing to be that 90% of professional C++ developers have never used syntax newer than C++99.
>>
File: lang_standard_cpp.png (35 KB, 1821x927)
35 KB
35 KB PNG
>>93675969
bs, my work is C++17 and that is not unusual at all.

See pic related
>>
>>93675996
Grim
>>
>>93675996
People that do gay little community surveys are probably disproportionately representative of newer standards.
>>
>>93676042
why are you attached to your narrative? lmao
>>
Whats the difference between a keyword and a reserved type name?
>>
File: 1576662998655.jpg (104 KB, 483x643)
104 KB
104 KB JPG
>>93675843
You're right, it's still input since it reads from the clock and whatnot, but it's a bit easier to use a method name in writing.

But yeah, essentially the point is to separate the "pure inside" of the IO from the "maybe undeterministic outside" of the IO. This allows you to go on your merry way assuming immutability everywhere inside of your program/code, because after evaluation the IO will enclose the result in an immutable fashion, even if perhaps you might not be able to create a new identical copy of it at a later time (but if you are able to do that, it still works the same way).
>>
>>93676042
that just means that if you like C++ you will most likely end up using C++17 at work.
>>
>>93675969
The only good thing about newer versions of C++ is the type trait shit. Otherwise, everything that's useful and good about the language (other than additions to the STL) was in as early as CFront v3
>>
>>93676259
you don't know what you're talking about, there are so many changes per language standard.

language AND library improvements.
>>
>>93675466
>passfag
>illiterate
Every time
>>
How does this segment of code work in java? What does each method do and why can't I use an int and need to use a var?
var stats = stream(numbers.split(" ")).mapToInt(Integer::parseInt).summaryStatistics();
>>
>>93676559
>>>/g/sqt/
>>
>>93676284
The vast majority of them are completely fucking irrelevant. I was uncharitable, C++98 did add a few useful things. bool, cast overloads, template instantiations, member templates.

constexpr and static_assert in C++11/14 were good additions. Scoped using. Template packing/folding.... hard to think of anything else that was added that wasn't just complete fucking garbage. Move semantics, r-value references, RTTI, lambdas, type trailing, coroutines, modules, a massive list of shit that's just total garbage.
>>
>>93676687
concepts
variant
any
optional
generator
jthread
counting_semaphore
>>
>>93676773
Garbage
Garbage
Garbage
Garbage
Cancer
Supercancer
Hypercancer
>>
>>93676861
>yes i'm a cnile how could you tell?
Go back to your dead containment thread.
>>
>>93676773
>concepts
Already achievable with the traits system. Did not need to add yet more redundant bullshit to the language.
>variant
>optional
>generator
>jthread
>counting_semaphore
Part of the STL which I said was useful. All of these are fully implementable with the language features I said were useful. In the case of jthread and counting_semaphore, you'd have to write compiler-specific code, but remains obtainable in a real programming environment none-the-less.
>>
>>93676904
Can't spell cancer without c, can't spell cancer++ without c++.
Dial 8 to your tranny-c. I only use real languages for real people, not codelet cnile cmen cletus clown cultist clunky clangs or its tranny derivative which believes slapping a skin dildo on the puC makes it "more" and not less.
>>
>>93676904
>>93676954
Programming?
>>
>push code to master without review
time to go enjoy my weekend
>>
>>93677014
>c and c++ are not programming related
the fuck am I reading? is this cnile's legendary big-C Cope?
>>
>>93677073
he means the cringe flame war
>>
>>93677073
I fixed a bug today. It was a really silly mistake. I love programming.
>>
>>93676559
>why can't I use an int
Use Integer
>>
>>93661886
In light of the Ledger shit, I am trying to piece together ideas for a cheap hobbyist hardware wallet
Want people to be able to piece it together without needing a custom PCB fabbed, using cheap dev boards and modules, and for it to be easily extensible in terms of community support for new coins
Need to decide which platform and get to writing the firmware, but I worry about security and attack vectors re: hardware (esp. the TPM), toolchain, libs, but idk enough about it all to comment (yet)
Welp, back to reading
>>
>>93676559
Dude I don't know what fucking tutorial you're using to learn Java but you NEED to find another one. If I ever saw a teacher show this line of code to someone in an introductory class I would immediately appeal for them to get fired.
>>
>>93677240
Poo in loo, pajeet, not in thread.
>>
>>93677381
what
>>
>>93677233
Just use trezor, it's open source. The only "problem" with ledger is you have to trust their firmware updates (which are proprietary), there's no other security concern. In fact it's the same for any other device, just that of course if it's open source it's easier to examine.
>>
I need help with a python code section i don't understand.

students = [
("Alice", 22),
("Bob", 20),
("Charlie", 25),
("David", 21)
]
sorted_students = sorted(students, key=lambda x: x[1])
print(sorted_students)
# Output: [('Bob', 20), ('David', 21), ('Alice', 22), ('Charlie', 25)]


Why the hell does
key=lambda x: x[1]
sorts things? As far as i know, all this is doing is taking an iterable x and returning the first index of it with x[1], in that list it would be 'David',21. I just don't get why it sorts and why it takes the second element of each tuple.
Could some anon explain it in detail?
>>
>>93677877
I forgot to mention: yes i know
sorted()
is what is sorting, but i specifically do not get what
key=lambda x: x[1]
does even if i know what a lambda function is.
I don't understand how a lambda function that supposedly indexes an element of an iterable works as a sorting rule.
>>
>>93677877
sorted takes the students tuple array
x is merely each tuple in the array
x[1] is the age
it's using the age to sort
>>
>>93677877
I'm not a python expert but the 'key' field accepts an expression which tells you what element of each tuple you're sorting by. 'x' is not the iterable, the iterable is students. 'x' is the tuple which is passed to the lambda expression every iteration; in other words, 'x' is each element in your iterable. The lambda expression returns x[1] which is the second (NOT the first) element in the table, in this case that's the number.
>>
>>93662329
for the love of god would you niggers stop posting this tranny shit, gtfo and kys already, 41% please
>>
>>93676942
>Already achievable with the traits system. Did not need to add yet more redundant bullshit to the language.

Anyone that says this is a retard that advocates template metaprogramming over proper concepts.
>>
>>93677240
I'm not doing any tutorials, I consider myself a intermediate to advanced beginner, its a solution to a problem I couldn't solve but I don't know exactly how each method works thats why I'm asking these questions.
>>
>>93678473
What are you talking about? This is a programming thread and transexual programmers are hecking cute and valid, bigot. The Hare programming language is inclusive, whether you like it or not. Hare is the rust killer.
>>
>>93679625
You're a very, very early beginner. I'm talking "first week" tier. I consider myself to have been thoroughly b8ed.
>>
>>93679652
Just say you can't explain what the code segment does retard.
>>
>>93679846
You are struggling to understand a literal hello world.
>>
>>93677497
I was thinking of it, someone built a pizero distro that uses Trezor, which is neat (although with caveats)
I'm a re/g/ard that likes reinventing the wheel. Having that aspect of control over everything, complexity, optimization, architecture, etc. Likely Trezor have done a way better job than I'll ever do, but no better way to learn than try. Worst case scenario, it becomes overwhelming and I end up using Trezor firmware (and potentially hardware schematics) anyways, but I gain knowledge, skills, etc along the way.
>The only "problem" with ledger is you have to trust their firmware updates (which are proprietary), there's no other security concern.
Yea I don't trust them, which is ironic considering I have a Ledger. Just something I couldn't be arsed to sort at the time, picked the easy option. Had to choose: Ledger, or integrate Cosmos SDK-based protocol support into Trezor.
Not plugging it in unless I've got an incredibly locked down, fresh distro to do so, without Live, with strict sandboxing and firewall rules to prevent it somehow pulling blobs and flashing itself, or something like that. I ain't trusting nobody for nothin.
>>
>>93680655
>>>/g/sqt/
>>
>>93675517
I prefer gcc and clang's warnings, and the fact that the error output in vscode has colors.
but you should use msvc on windows, and gcc or clang on linux.
And just use linux for development.
you can use clang-cl to get the benefits of clang on windows (for example I wrote a wrapper around printf, but I won't get warnings for incorrect formatting, but if I use __attribute__((format(printf, 1, 2))) I can get warnings), but personally I would rather save those 2 gigabytes if I'm using linux anyways, plus I think your code is better if it has zero warnings on gcc, clang, and msvc.
>>
>>93665832
>only autistic people care about sourcehut, drew devault, plan 9, fediverse, neocities, etc
>many troons are autistic
do the math
>>
>>93680753
Neither of those are true. You also don't know what autism is or does.
>>
>>93676257
NTA but it doesn't really.
>>
>>93675290
Wdym? We use modules and cargo takes care of downloading, importing and linking the libraries for us. You are mentally disabled.
>>
>>93681112
I want to call a C function, you fucking genuine retard.
>>
>>93681247
>why does not rust generate binding and linking for my external dynamic C libraries
Turns out, Rust is not a C compiler.
>>
>>93681734
Other language do not have this problem, as demonstrated itt.
>>
>>93681876
What the hell are you talking about man
>>
>>93681876
>Other language do not have this problem
Because someone worked hard to make that binding layer. (Except for C, because duh, and C++ because that's always had that, warts and all.)
>>
>>93683149
Take your meds.
>>93683241
Of course, but that's what the original objection was about. Though it's hard work, it's a one-man project over a couple of weeks, no more. Now adding C++ bindings is another story altogether, but C isn't so bad. Wit the amount of funding and manhours invested in it, you'd think that wouldn't be a problem for the rust team. Given how horrendous the unsafe{} experience is, you'd also think the priority would be high enough to warrant it yesterday.
>>
>>93676687
>coroutines
I was looking at the standard on them earlier this week. My thought was "Could this possibly be made harder to use? I'm sure it could if they'd tried, but I can't see how." There are languages which do this shit right (there are two ways to do it) and yet C++ manages to find a different way entirely. Which is C++ all over.
>>
>>93683305
>Though it's hard work, it's a one-man project over a couple of weeks, no more.
Callbacks can be more complex. No, scratch that; callbacks can be a lot more complex. Things get pretty weird. (People use C in weird ways.) However, the main annoying thing is when the API is actually full of macros.
C++ is like that, but with far more mess due to templates and so on. It isn't impossible to bind C++ but it sucks so much rabid skunk penis that you'd think it was from backwoods West Virginia. Most C++ programmers wouldn't know a stable ABI or API if ran up, kicked them in the testicles, shouted "I'm a stable ABI" in their face, and then sprouted wings and flew off to Bahamas while whistling Dixie backwards.
>>
>>93683506
>Callbacks can be more complex. No, scratch that; callbacks can be a lot more complex
Depends on a lot of factors. That's definitely true, for example, if your language uses a compacting GC and/or complex scaffolding in function prelude/postlude. Aside from that (at least on x86_64) I haven't seen a failure case in either my toy implementation, nor the binding generators I know about (some of which I know for a fact were also one-man projects).



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