Is that Rust copypasta about C and string mutation really true bros? C(hads), what's our response?
It's All Fucked Shirt $22.14 |
It's All Fucked Shirt $22.14 |
Is that Rust copypasta about C and string mutation really true bros? C(hads), what's our response?
It's All Fucked Shirt $22.14 |
It's All Fucked Shirt $22.14 |
Surely this can not be true
It's true. String processing is not a strong suit for C.
C was created to run on DSP and Kernel. It's a DSL for niche hardware. It's nonsensical to use it anywhere else.
it is for null terminated strings, strings with explicit length are fine. Null terminated strings can be useful in other situations though.
It's not uncommon to create custom string functions which do this. In the end, C's curse is its shitty standard library.
You'd have to create a new string type to emulate Pascal/C++/Rust strings too.
Null terminated strings are so weird to begin with given that array termination in C is just “passing the length” everywhere. Why not do the same for strings then?
The problem is that many functions expect a null-terminated string now so they must all be rewritten.
And yes, surprise surprise, a language that came out 50 years later that learned from all the mistakes of past does things better.
Of course C is terribly designed by today's standard, and in 50 years Rust will be too as people learned more.
>And yes, surprise surprise, a language that came out 50 years later that learned from all the mistakes of past does things better.
>Of course C is terribly designed by today's standard
C was already badly design by the standards of the early 1960s, ten years before it existed
By the time it came out it was downright laughable
It succeeded despite itself, the JavaScript of its time
>how to tell people you're stupid without telling them you're stupid.
It sacrificed design for performance.
Of course ALGOL was much more pleasant to program in, but C was designed as a language wherein operating systems could conceivably be written which before that was all done directly in assembly and it was a big improvement in that sense.
Nowadays after many new innovations Rust manages to have the same performance but avoids most of it's warts.
>It sacrificed design for performance.
It wasn't even as fast as other systems languages until increased uptake (and competition from LIL) pressured them to add optimizations
The main reason they didn't have an optimizing compiler right out of the gate was that their real priority was keeping the implementation simple
In fact, with B, they made it too simple, and it was useless
C was the compromise
>other systems languages
Such as? There was BCPL, PL/S, BLISS, JOVIAL, and assembly. PL/S, BLISS, and JOVIAL were proprietary to IBM, DEC, and SDC respectively, assembly wasn't portable, which left BCPL, which was (a) the parent language of B and (b) also didn't have an optimizing compiler.
Yeah you covered most of the ones that mattered
BLISS definitely had at least one optimizing compiler by 1972 (not that anyone can keep track of how many architecture-specific dialects there were) and its design was plenty influential even though the language itself was basically a dead end
Fortran was the king of speed demons for like 50 years, but obviously wasn't something you'd use to write a kernel
Pascal, maybe not in its original form, but dialects of it were in fact used for that purpose (at Apple and some other places I can't remember) in the 70s and 80s
Anyway what I was trying to say was that speed was not the selling point of C when it was young
It spread because it was "free" and portable and easy to bootstrap
BCPL and B spread for about the same reasons, and were used for all kinds of shit, but C beat them by being the Unix language
>Null terminated strings are so weird to begin with given that array termination in C is just “passing the length” everywhere. Why not do the same for strings then?
Uh, you can. Everyone already knows this. Null-termination is concise and works fine for most applications, but for the minority of cases where it isn't appropriate, it is piss easy to just use a char array and length.
I'm sure most of the complaining about C-strings is low effort trolling, but anyone who actually feels restricted by it is either a moron who doesn't know how to do the most basic things with the language, or so implosively autistic he would also get hung up on shampoo instructions ("rinse, repeat... repeat... repeat...reeeee).
These type of threads only serve to remind what a shithole this place has become.
The point is that the standard library and many other functions don't observe this convention and expect a null terminated string or the behavior is undefined.
This speaks like having no experience programming in C. One has to pass a null-terminated string or completely re-invent the wheel every time, and that means copying the entire buffer when making a subslice of a string except for slicing to the end.
>and that means copying the entire buffer when making a subslice of a string except for slicing to the end.
You also need a workaround for null characters that may be present in the middle of your not-null-terminated string.
>the standard library
see:
>anyone who actually feels restricted by it is either a moron who doesn't know how to do the most basic things with the language, or so implosively autistic he would also get hung up on shampoo instructions
>The point is that the standard library and many other functions don't observe this convention and expect a null terminated string or the behavior is undefined.
oh no! Whatever shall I do without my strlen or strcmp or strtok?
Prove to me more you never actually programmed in C.
Try using any library for about anything complicated. They pretty much all expect strings to be null terminated.
A lot more libraries expect you to pass in a char/void/uint8_t array with explicit length
Which ones?
Xlib, glib, Qt, OpenSSL, they all demand null terminated strings everywhere.
Like, do you even ever do basic things like open files which of course want null-terminated strings?
Real C programmers obviously don't use any of those, that would be a mistake and real C programmers don't make mistakes
>Muh real programmers don't use Xlib
yeah, zero experience in actually using C code in any actual code base.
Again, what library doesn't use null-terminated strings.
Literal string constants include them anyway.
>Null-termination is concise and works fine for most applications, but for the minority of cases where it isn't appropriate,
>strlen is a minor case
strlen is deprecated
use strnlen
C is deprecated
Use Rust or C++.
I don't know much about c or rust, I can just sort of hack things together in python. But, you are responding like a shook homosexual, so I assume you're wrong. C wins.
>I don't know much about c or rust
We know. Biggest C shills are nocoders themselves.
>Null-termination is concise and works fine for most applications
please stop coping
>They must all be rewritten
Implying dumping UNIX like the turd it is would be a bad thing
>And yes, surprise surprise, a language that came out 50 years later that learned from all the mistakes of past does things better.
Null-terminated strings were already bad 50 years ago. C did not learn from any mistakes of the past and ignored what was considered the good way to do things.
The catposter is an obnoxious troll and the post contains multiple dumb mistakes but let's examine the actual claims
>the string is null terminated
Obviously true
"String" is a strong word when we're discussing C, because they're basically just a convention, but if you write a string literal, it's null-terminated
>In order to slice the original string, the newly created slice must have a at the end
True, with caveats
The main issue here is that most of the C standard library, and shitloads of system calls, expect strings to be null-terminated
You CAN use an alternate string representation with explicit termination, and write your own string manipulation functions that understand whatever idiom you choose (slice length, end pointer, whatever)
You CANNOT control what other code expects at API boundaries
>even their compilers aren't written in C anymore
Also true
Clang and other major C compilers were written in C++, and GCC migrated from C to C++ years ago
Fringe options like tcc and pcc produce slower code than the above alternatives, and since they can't compile C++, they're not even much use for bootstrapping or diverse double-compiling, which is probably why they're effectively unmaintained
>not knowing how strings works internally so you know to create your own slice class to avoid unnecessary copies
Look, I'm not saying this is a skill issue and crustaceans can't into low level programming, but you guys keep posting some pretty moronic shit lately and thinking your lack of expertise about how shit works counts as a W.
You say rust is good because C++ lacks memory safety and you think that's a W for you. In reality, good programmers never have an issue with memory safety because we just know how pointers work. When you pick rust you're telling everyone you're too dumb to know the internals of programming and you need the compiler to hold your hand so you don't have a nice day in the foot. We just don't aim the gun at our own feet. It's that simple.
Clockwork.
Anon, you use memes to cope with your lack of real skill. It's pathetic. Why don't you go learn how to reverse a linked list without chat GPT.
Not a meme.
Fix that last line you fricking hack
In that same thread you find picrel
And yet morons here keep falling for OP's bullshit.
you will only ever output one string, you can use char arrays and then copy them to the actual file you are handling strings for. All of this quality of life bullshit never has any real applications.
>b-but slicing makes up for my lack of knowledge and will!
you need to know the range of chars in the string anyways no? hardcode the values into the new string you fricking moron, thats what the compiler is doing anyway.
>you need to know the range of chars in the string anyways no? hardcode the values into the new string you fricking moron, thats what the compiler is doing anyway.
Wtf are you trying to say? How does slicing correlate to lack of """knowledge and will"""?
Cniles always say the most moronic shit imaginable.
>Wtf are you trying to say? How does slicing correlate to lack of """knowledge and will"""?
nta
but he prolly means that youre a mong moron
>he doesn’t know about string indexing
>indexing will accommodate for shitty char* representation
char whole[] = "Whole slice";
char *slice = whole + 6;
Here's your zero-copy null-terminated slice.
And what if he wants whole [0..3]?
struct string {
char *slice;
size_t n;
} Black person;
char whole[] = "Whole slice";
Black person.slice = whole;
Black person.n = 3;
>struct string {
> char *slice;
> size_t n;
>}
lmao well done, you just discovered std::string. Dumb frick cnile.
ok? i primarily write sepples
Obviously. The issue is that the entire stdlib and so many other functions expect null-terminated strings that it doesn't do much.
C doesn't have proper strings. In C++ there are
1) Cstrings (actually char arrays), and
2) proper/real strings.
C is very bad language for processing text. C++ is much better at that. Which is why you should actually write mostly C but you should always use C++ strings in your programs. Or just use Go or Rust.
std::string is so completly worthless that it shoud never be used by anyone for any purpose.
Then why do cstrings lead to so many bugs and security vulnerabilities??
Its true... its all true...
FRICK
Get a life samegay
How to kill a cnile with a stroke:
>tell him to implement double linked lists in C
>rustroon thinks double -linked lists are hard
protip: add a pointer to the last element of your list so that you dont need to traverse the whole shebang to add an element
>shebang
troony word
>calls others troony
pottery
>origin of the word: mid 19 century
aaah, 1 googling away from self btfo.
thats sloppy, anon. you can do better, i believe in you
the way shebang is pronounced is effeminate and thus troonypilled
that depends entirely on who pronounces it
Fun fact: The word vegana comes from the Latin word for "sheath" or "scabbard". The Latin word vāgīna originally meant "sheath" or "scabbard". Tay tay has a wiener scabbard or wiener sheath between her legs and few men have had the privilege to introduce the peanus weanus there...
geg. that was instructive. have a you
>protip: add a pointer to the last element of your list so that you dont need to traverse the whole shebang to add an element
>dewd I'm so smart I know that pointers exist, what now?!
That's not a protip, moron.
lol, seething
have a walk. youre gonna end up with an ulcer
Not everyone has dogshit homosexual ulcer genetics like you, troony. Now hush, keep quiet. You're embarrassing yourself and it's just sad, you know that?
>i didnt crash until now, so i dont need your seatbelts
geg. you do you, anon. i will even support you in that endeavour, why not?
There's no need to project your anamnesis on me.
im the one who originated that saying doebeightever
It's not possible to implement a doubly linked list in Rust safely.
C string handling is shit and it's always been shit. Even before rust existed, I remember hearing jokes about how the first thing a new C programmer did is make their own proper C strings library. Because C is shit at handling strings.
IDK why you'd need a rust copypasta to tell you what's sitting right before your eyes. I don't even dislike C and I'll admit it.
rust async is cancer but I think they'll find a way to make it sensible
WHY DOESNT C HAVE A BUILT IN JSON LIBRARY, HASH MAP LIBRARY, HTTP SERVER AND CLIENT, GARBAGE COLLECTION, LAZY EVALUATION, KEYWORD ARGUMENT AND MULTIPLE RETURN VALUES? CNILES SEETHING
>he doesn't know about libgc
N-NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO C CAN'T HAVE STRINGS BECAUSE..... BECAUSE IT'S TOO HIGH LEVEL OF AN ABSTRACT*Segementation fault (core dumped)*
Underrated
cbros.... not like this...
group cope therapy
>I-I'm not coping YOU are coping
do these things on your own and you will be a better programmer.
>just reinvent the wheel you will be a "better" programmer
unironically, yes.
at the most basic level, its called "practical knowledge"
(nta)
"Practical knowledge" doesn't increase if you reimplement the same problem for the 50th time. The word you are looking for is "memorization".
>doesn't increase if you reimplement the same problem for the 50th time.
it actually does.
or someone is as moronic as you and doesnt know you can re-use code.
youre making different implementations with different parameters otherwise. in whose you most likely will be re using code anyways...
>whose
which. esl at 5am moment
't increase if you reimplement the same problem for the 50th time.
>it actually does.
No it doesn't. Maybe that's what you are taught in the shithole you are from but that's far from the reality.
>you can re-use code.
So you are saying there's no point on solving the same problem for the 50th time? Good to know. Don't argue for the sake of arguing.
catastrophic reading comprehension failure
I mean you will probably learn something from doing it.
Not worth the time though, not worth it by far.
What is worth the time then? Caressing your dick while you watch your hoscii or whatever the frick play runescape? You have so many years dude
Open a good textbook.
Implementing a JSON parser just to learn more about parsers is a lot of time for very little gain compared to reading a good book about how parsers work.
you learn more than just about parsers.
you learn about data structures
you learn about optimization techniques
you practice the language
well, not (you) per se. cuz youre dum.
and it shows.
and when you by heart your book
writing what you learn makes it active learning,and improves efficiency by multiples
youre ignorant. and dum. and prolly wont do anything about it ever.
>broo you discover data structures by parsing json
Where do this brainlets even come from?
no, using various data structures (which can be pretty funky in C), well, gives you practice in using data structures
no wonder youre getting replaced by indians. you get btfo'd by basic causality.
You can practice solving real world problems instead of making a shitty reimplementation of a json library. I can tell you are a mediocre programmer with zero practical knowledge in the industry by your posts, because you never had a deadline to meet.
You're probably a college dropout hobbyist C programmer just like the 99% of the C "programmers" in this board. Go back to desktop threads and LARP there. You will never make it.
>You can practice solving real world problems instead of making a shitty reimplementation of a json library.
real problems like... fizzbuzz?
you really should go to a place more suitabke to you.
>real problems like... fizzbuzz?
I don't doubt that's your peak achievement. Go back to your containment thread.
>cant comprehend irony
you are sub 80 iq, arent you?
The real irony here is you. Stop giving programming advice as a hobbyist programmer. You are in no place for that.
Go ahead, write another shitty json parser that nobody uses. I'm sure you will land a job some day.
>i was only pretending to be moronic
>but while were at it, no u
pick one
Ah yes, the meme-speak deflection. I'll let you have the last reply as a pity, because that's the only validation that you will ever get.
i dont need your validation.
i make my money from my code, directly. im my own customer, my own employer. i consume the tools i create, and thats how i make my bread.
its all the validation i will ever need, wagie
Real problems like writing a Windows registry dumper that runs in under ten seconds on every boot
im on loonix. its not a real problem for me.
>WHY DOESNT C HAVE A BUILT IN JSON LIBRARY, HASH MAP LIBRARY, HTTP SERVER AND CLIENT, GARBAGE COLLECTION, LAZY EVALUATION, KEYWORD ARGUMENT AND MULTIPLE RETURN VALUES? CNILES SEETHING
C has string functions in the standard library but they don't work. It's like a language that has a JSON library that works so badly that the people who use the language tell everyone to ignore it and write their own.
>rust trannies use third party library for async
Because there isn't one in the standard library. This does not match the post
You can do it with reference counting or you can do it with indices into your own storage
>cniles just don't use async
I'm not sure which is better
Write your own string library
>C(hads), what's our response?
"shut the frick up moron and go back to /lgbt/"
because posting "struct str {char *start; char *end;};" didnt do it
String slicing feels like it shouldn’t be that difficult, it’s basically just taking a char[] and AND-operating it with all ones for the new size and shifted by the range, that is like 3 lines of assembly tops
This isn’t abstract at all
No rustards just like to pretend that there is such a thing as a zero copy string. That only works if you strictly only read from the string. If you mutate the string in anyway then you'll need to perform a copy. C can mimic this behavior you just have to be more explicit which is a good thing because you are not hiding what you are doing behind compiler magic.
>cnile brainlet hasn't discovered CoW yet
It's over
>rustroon needs an inbuilt for
struct moo {char *start; char *end;};
>cnile has to reinvent strings every single time to work with string
Humiliation ritual.
>rustroon doesnt know you can re-use code
ugh. you might wanna chill with the humiliation rituals.
im feeling dirty. it feels like punching children
>reuisng code from stdlib is le hecking bad
>reusing code from some shitty reimplementation is hecking good
Most intelligent cnile.
>homebrew implementation beats stdlib several times over
wat do???
Find a better language
You will never be a real programmer
>find a better language
write one.
>t. filtered by pointers
Slice IS a pointer, your shitty null terminated trash can't slice because your trash lang APIs work on null bytes instead of len.
*2 pointers.
or a pointer and a len, but thats less efficient to work with
also:
>api
lol. codemonky. we call that libs.
and if you use libs for strings youre gay and deserve using the nullbyte
An API is a programming interface exposed by a library. Learn to code. Teaching you basic terminology is not a good use of my time.
Copying the string address is a constant time operation, copying entire string is linear time.
If you do not understand the difference between string address and the entirety of string you are not fit for this conversation.
>Learn to code.
its a life long process.
but youre a codemonkey, so what would you know about that?
childish.
you must have autism.
>Rustoids moving the goalpost because they lost
Zero copy means zero copy not kind of zero copy. How about you learn to read before trying to code.
>same guy
nope. im not a rustroon. i dont samegay
So am I talking to 2 ESL subhuman Black folk?
Not surprised.
>humiliation ritual
Maybe to a degenerate such as yourself. I view it as a divine process of optimization. I find myself returning and optimizing more and more. I grow closer with true algorithmic enlightenment as I ponder the flow of electrons through my computer. My zen is unimpeded by my compiler. My soul is free while yours is bound and owned by the rust compiler. Your mind trapped in a box of ownership you can never unwrap().
>reimplementing the same string library is le divine optmization xd
Ok schizo moron. Keep your fanfic to yourself.
You are the same guy? Why do you reply multiple times? Can't put your thought into words at once?
Zero copy slices means zero copy slices. I fail to see why are you being hard-filtered by such a simple concept that was being used in 1960.
>Zero copy slices
There is no such thing. You have to copy something from the original. You either have to copy the address and a length or copy the whole thing. In the end copying is still occurring. Which surprise surprise you can do this exact behavior in C its just not a language feature. You have to implement it yourself, but that is not hard at all.
>You either have to copy the address and a length or copy the whole thing
That's not how pointers work. Pointers point to the original address, a pointer to a pointer will also refer back to the original address.
Why the frick am I even wasting time teaching these third worlders CS101 shit anyways? Get the frick out, you will never make it.
omfg you copy your pointers to registers to do anything with them
american cs courses everyone...
and you pay through the ass for that. lmfao
nowonderyoure getting replaced with h1bs.
youre worthless. worse than worthless.
youre actively damaging to the company you work with
Are you the same third worlder samegayging again?
> you copy your pointers to registers
You don't do that in C either, it's done in the compiler level. The register keyword is nothing but a compiler hint.
Slicing does not work by copying the pointer, it works by creating another pointer that refers to the original address.
And none of this has to do with zero copy slicing. Do not argue with me for the sake of arguing. You are not smart, and your desperate attempt in muddying the water is very clear to anyone who has done more programming than you.
>you don't do that in C either, it's done in the compiler level.
lol what a moron
were not talking about how things "look",were talking about how things "work"
im at a fricking loss
youre really sub fricking 80
and again,no, im not samegayging
id take a screenshot but im not sure i can get anything to workon this pos old hardware im currently using.
and even then i could modify the html to forge the (you)s or lack thereof
>were not talking about how things "look",were talking about how things "work"
I'm talking about what YOU do, not the compiler.
When I say slices are zero copy, where the pointer to the pointer is stored is none of my business as the kernel will determine the location of the pointer.
My business whether slices are zero copy or not, and indeed they are.
And when I say copy, it's copying the original sequence that the slice is referring to, not the pointer address. Don't muddy the water.
lel what an idiot
the compiler does only what you ask of him.
>im sorry but its not i who killed the child, it was the car i was driving
what a fricking fool you are
fricking room temp iq motherfricker lmao
>the compiler does only what you ask of him.
No it does more than that. You are not writing machine code, you are writing a high level language.
Do not argue for the sake of arguing, you are not smart.
ahahaha and when you drive a car you move the pistons by hand, right?
you rustroons are a riot
just the relaxation i need after a day (night) ofwriting code
>lose argument in every single technical merit
>fully devolve into allegory
As I said, you are not smart. I'll let you have the last reply like I did for the other nocoder ITT because pretending to "win" in IQfy is the only form of success you will ever taste. I'm a generous person.
i dont need to be smart when im right
didnt i call you a prostitutealready?
didnt it transmit the idea that youre less than dirt for me?
then why you think i care about your opinion aboutme?
are you dumbon top of being dishonest?
>it works by creating another pointer that refers it the original address
You are so fricking dumb it hurts. Where is that address stored? The fricking ether. Its stored in the fricking pointer. You can't reference the original address without getting that address from somewhere holy shit you rustoid are dumb.
here you go
25 secs between the twoposts
also old shit laptop is why the space doesnt always register
This thread is a damn disaster the collective IQ between these two morons is below freezing.
>ad homonem
you code in rust.
no need to deny or confirm, i know that you do.
intellectual dishonesty is the signature of your community
Let me clear this up for you two. You're technically right in the narrowest possible sense the MOVing an address is technically a copy. But if a MOV is a copy then an add is a copy + addition. You see how dumb this is and you've just twisted yourself into this pretzel because you don't want to cede an inch of ground to the Rusttard.
You're even dumber and have twisted yourself around the other guy's pretzel. In fact, you're so dumb that I can't even explain why you're wrong without writing an essay explaining pointers and the type system. A fat pointer is just a pointer to some memory + a length. There aren't eleventy-billion levels of pointer indirection added when you do complex string operations, slicing a string is just some addition to the pointer and subtraction to the length.
>because you don't want to cede an inch of ground to the Rusttard.
stfu you prostitute
rustroon started with insults.now he can get fricked
>you're so dumb that I can't even explain why you're wrong without writing an essay
i accept yourconcession
you can go away now
Those "mathgays" you hate invented pointers. C shills are the dumbest people on earth.
its a fricking joke you fricking autismo you
learn to human, scrub
Your thousands of posts are all jokes?
>thousands
youre giving me more credit than is due
unless you mean everything i postedin the past 4 years
also no, i though it was pretty clear were talking about the picrel
bc of your anal autism i guess i have to specify that all of my posts arent serious either...
>disaster level IQ
You don't understand what you are talking about. The string and the slice are different variables. That means they each need their own pointer to the address. When you create a slice you alloc the space for the slice either on the stack or the heap. Then you get the address from the original string and apply an offset if it doesn't start from 0. That is the address of your slice. Then you do a check to see if the substring is long enough for the requested length if it is you store that in the length variable. In the end copying is still required as you got the address for your slice from the original string.
>don't muddy the waters
That's what I was saying from the beginning. You go on and on about low IQ, but you didn't even read the post correctly.
Can you read? I told you that you're right in the most useless possible way that copying the address is technically a copy but it is completely distinct from C where copying a string means copying the whole damn thing. If taking a slice of a string is a "copy" then so is every other machine instruction.
>So is every machine instruction
No argument there. My issue with this entire copypasta is that it faults C for not embracing a language feature that rust chose to add. C can do this its just not explicitly a feature. I would argue that the application for a read only slice is a pretty narrow scope. I guess it could be said that it is a nicer abstraction over substring which I won't argue.
nta but
>C for not embracing a language feature that rust chose to add
C actually chose not to add this feature because B didn't have any structs and they wanted to maintain a level of familiarity with B and BCPL. Pascal already had this feature which came out before C.
The entire problem is the fact that C can't do slicing ergonomically which means that C and the rest of the computing industry are forced to use an objectively inferior string representation. I like C and I think this a valid criticism. I would like to hear the Rusttard explain what he thinks the difference between a pointer and an address is and what he thinks the OS has to do with it lol.
When did I say pointer and addresses are two different things?
What? I still don’t see where I said they’re different? Can you quote the exact line?rrkt
Let's back up and pretend I never said that.
>Slicing does not work by copying the pointer, it works by creating another pointer that refers to the original address.
This shit make 0 sense and I want you to elaborate. When I initially read it I thought you you thought it created another level of pointer indirection but I really don't know what you actually think.
Either way you're wrong about pointers or you're wrong about slices, I'm currently leaning toward both.
Yes I meant another pointer indirection such as &&str
You're wrong then. A slice of a slice of a slice is still a &str. All slicing is is one or both of these: an addition to the pointer or subtraction to the length.
A string is reference to a vector of u8s. If you slice it, it’s a reference to that reference. Of course the compiler will optimise the extra indirection away. But I never said pointer and adddress are two different things.
https://godbolt.org/z/vnzbnxjhd
Optimizations can't be observable in code.
>but you didn't even read the post correctly.
What post? You are confusing zero copy slicing with zero copy aliasing.
>confuses zero copy slices with zero copy aliasing
>AGAIN
There is no way we aren't living in a simulation.
>Slicing does not work by copying the pointer, it works by creating another pointer that refers to the original address.
IDK what exactly you think but this is what convinced me you have absolutely no clue what a pointer or a slice is. As I said in my earlier post, this is you wrapping yourself around the other guy's pretzel.
>Rustoid hallucinations
When did I ever say pointer to pointer? I said you need to copy the address. A pointer is just a memory address. You need to point to the start of your slice with a pointer and then you need a length to dictate how long your slice will be. That is still copying something from the string.
>rustard doesn't understand slices
>doesn't realize you still need to copy the string address
No such thing as a zero copy string rustard.
>zero copy string
zero copy SLICE you fricking subliterate mongrel brainlet.
>when all else fails, just grammar nazi
i dont think the other anon will accept this concession
>reeeee
Fricking cope rustoid. You know you lost and must return to the hells from whence you emerged.
>get filtered by slices
>y-you lost
NGMI cnile
>rustoid reduced to rewriting history
NGMI, I taught that wanna be that there is no such as a zero copy slice. At the end of the day just like how you guys are dependent on soi for your nutrition you are also dependent on the compiler for your technical prowess. Your minds decay from the lack of use and you say silly things. C will always have a place because it rejects your silly notation of zero cost abstraction. Your language is the worse kind of footgun. The kind that makes you less intelligent for using it.
>I taught that wanna be that there is no such as a zero copy slice.
Just because your shitty representation does not support zero copy slices doesn't mean it is impossible.
In fact it was possible to do zero copy slices in ALGOL 60 but cnile cult brainrot has completely damaged an entire generation of programmers perception of computing.
>he doesn't know that you have to copy the string address
>What rust brainrot does to a MOFO
NGMI
>reading comprehension failure
this seems to be a pattern with you rustroons.
No sorry I cannot read gibberish. "I taught that wanna be that there is no such as a zero copy slice." is not valid English.
You will never be a real string.
>CoW
>COPY on Write
ON WRITE
N
W
R
I
T
E
glad we agree, because that's exactly what
was saying :^)
>readonly operations are fake news now
AINTNOWAY this is not a simulation. You are a low functioning bot designed to see how I react to brainletism
>That only works if you strictly only read from the string.
lrn2read moron
Your point being?
>left turn doesn't exist if you are taking the right turn
unreal bro
anon, I legitimately hope you're pretending to be moronic, this is actually concerning. Reread the reply chain and think about what the initial posts said for a little bit. I'll give you a hint, we are not actually disagreeing on anything.
>firetroony updoot in the beckground
>you hav to restart now
what a gay ass fricking browser.
iminstalling braev
anyhoo
it was fun and relaxing
cya around,rustroons
lol. self btfo as a cherry ontopof this thread
emperor bless you, anon
in c you use loops to do anything with strings.
people just don't want to write for loop for some reason.
>Cniles dancing around the lack of slicing because their shitty char* is useless.
Cultbrain
I know programmers that use strings and they are all cowards
Holy shit people on IQfy literally have no clue how the computer physically does things
Literally the blind leading the blind
Every other iteration of this thread some Cnile will reveal that they think that the C string representation is something intrinsic at the machine level. Now we've got a Rust homie in here with a misunderstanding of pointers so bad it's impossible to pinpoint what exactly he thinks pointers actually are. It really is bad.
The rust poster is moronic
You don’t know what I think what pointers are and yet you’re saying what I think is wrong?
>Now we've got a Rust homie in here with a misunderstanding of pointers so bad it's impossible to pinpoint what exactly he thinks pointers actually are. It really is bad.
He didn't misunderstand pointers. He knows the difference between a pointer and a string. C shills don't know the difference between an address of a string and the string itself. When the Rust chad says pointers are not strings and copying the pointer does not copy the string, you can't even understand him.
I reported OP for instigating a flamewar. In before I get banned for announcing a report and OP's thread will make it to bump limit, filled with trolling and flaming.
>using C for string manipulation
What kind of masochistic shit are you nibbas up to?
nigo
you write your code once and then you live happily ever after
its like you high level gays forgot you can reuse code
Some rust programmer explain me this: Let's say I have a string slice, and I want to open a file with that slice. The linux syscall expects a null terminated string. How can rust do this without copying the string?
The standard library makes a copy of the string.
On Windows it'll even transcode it from WTF-8 to UCS-2.
I expect the syscall itself is far more costly regardless.
So the slices are zero-copy until they suddenly aren't?
I don't get this then. If I'm writing my own code, I'll use pointer + length where it makes sense. Just like rust. If i need to make it a null terminated, either 1) copy it, or 2) just insert a NULL byte where it is needed, and after the operation write the original character back. Rust also copies it where needed. Seems to me it works the same.
The nice thing is that all of the standard library already works like that and so do all the third-party libraries. You don't have to swim upstream for this. It just werks.
There's no part of it that's impossible to roll yourself in C.