>btfos your C
C++ > C
link your github poser
what is string.h
#include
>all we need for char strings
>same library as printing, so only one library needed for import
>btfos your specific string library for c++
>char strings
who else bstring gang
>same library as printing, so only one library needed for import
>using print
lmao, medieval was more than 100 years ago. either you use gui or you can gtfo with your hello world software
it is terrible and pointless
Learning c++ what can I do with this
C is for lonely people
c++ is for a team
not having to fuck with char arrays. You get strings that work like any other language.
theres not a single thing c couldnt do that c++ could, c++ is redundant
STL has strings
>Must reverse the content of a text file issuing GUI
Open web-browser, find website that do it for you, copy/paste content half the file (because website limitation), past in new file, do the second half
>Using UNIX-Like system
Open terminal, `rev < myfile.txt >revfile.txt`
hit me with your best C++ books
already have Stroustrup's "The C++ Programming Language" and "C Primer Plus"
There's not a single thing lambda calculus couldn't do that C could. C is redundant.
Nibba how you gonna implement lambda calculus in hardware
>both c/c++ uses useless types
>meanwhile master race modern languages uses dynamic typing
>no need for pointers anymore
>>both c/c++ uses useless types
>>meanwhile master race modern languages uses dynamic typing
>>no need for pointers anymore
Master race languages don't have typing. Data is data, man
runtime dynamic typing isn't really needed, auto is good enough
Is auto the c++2017 version right?
I'm programming a videogame
why should I use C over C++ or just gamemaker for that matter?
Is there any benefit whatsoever?
and no I don't give a shit about optimization
sure? I can use it in c++11 IIRC
>same library as printing, so only one library needed for import
Nice, free bloat
no user
jlmg
c++ string are total garbage you should be using 3rd party string libraries
I would actively discourage making a game from scratch if you want to have anything to show. There are many fine engines available currently, some for free (beer and speech).
Will I benefit at all from understanding the language?
I'm halfway through learning and I don't want to quit.
If you struggle with arrays or pointers then C simply isn’t the language for you. Learn to manage memory properly or switch to java.
Not really. You can write thousands of practical programs that don't require any memory management at all. It's always cart before the horse with people. Get comfortable writing programs in general and stuff like arrays and pointers come with time.
> 2018
> can't split strings
> can't find substrings
> can't iterate over unicode strings
"oh okay but do you have a moment to talk about our cool 2D graphics library in upcoming C++35?"
>needing more than string::find
Enjoy your quadratic time substring search lmfao
>worst case is average case
>You can write thousands of practical programs that don't require any memory management at all.
You can write thousands of practical programs with one hand tied behind your back. Or in MS Wordpad. “can” doesn’t mean “should”.
It’s a major advantage of C and if he sees it as a problem then there’s something seriously wrong with his expectations of the language. If you have the wrong approach, the only things that come with time are frustration and bad habits.
C#>>>>C++>C
Java >>>>> 50 ft pile of trash >>> C#
>Job openings
>Scratch
Wat
>dude strings (literally anything that can be represented by text) are just arrays, it makes sense
>also, C doesn't actually have arrays, it just has pointers
>also these groups of pointers can't be resized, so just hope no one ever types something longer than what you provide
>also every string has an extra character appended on the end, so make sure to account for that
>also, make sure to initialise it to an empty string. Your program won't crash, it'll just point to garbage
Good luck making a program that's meant to be used by a human.
Honestly I'm at that point where if a language has a "string" and a "char" type, it's garbage. There is no "char" type, just forget it. The "string" type should be called what it is, like utf8str, or something.
>utf8str, or something
Nah, fuck that - unicode was a mistake
Everybody should've told chinks to just shut the fuck up and switch to using english
>2018
>putting things on the heap unnecessarily
>hurr sepples fast
C++ brainlets please leave
theres not a single thing asm couldnt do that c could, c is redundant
>dumb cnile once again thinks c++ is java
But you can put everything you like on the stack. Nothing about C++'s programming model requires you to use the heap.
be portable? c is needed
Portable languages existed long before C. You're flat out wrong.
&68502907
This is weak bait.
Watch this.
std::any
>&
fail
it's still just an array of bytes terminated by zero byte, literally no difference from C
also fuck accented characters as well, right?
>in-demand = good
Go back to work Pajeet
What is your argument for it being garbage?
I don't have that, big boy.
Whatever you say, NEET
Wtf is a char string?
Based. I hope it will be useful for encoding type objects in an interpreter.
Poo.init()
Pajeet leave pls Java and C# are both shit.
C++ and Python are god tier
char * p = (char*)malloc(sizeof(char)*1024);
>pointlessly allocating a kB for an initialized array of chars
Do cniles really believe this shit?
>casting
a string of chars
there is no apology for worst case not being O(n)
>i'm afraid of pointers
>i'm afraid of horse carriage
is your argument that asm is more portable than c?
In many cases using the system as the GC is the most efficient: just allocate, do the work and terminate
Strings are just glorified char arrays
Just have a huge-ass pagefile. As long as the program isn't going to run for longer than a day, the null gc actually works.
Null termination was a terrible idea. A TERRIBLE idea. C strings are just the worst.
You need to know how to program to make a game. The better your programming abilities, the better your game logic will be. C and C++ are good languages for learning, even if you end up applying those skills to some game engine scripting language.
You're retarded. The point of the char type is that it uses one (1) byte. It's the equivalent to the Byte type in Java.
portability is vague term that can mean too many things, C's portability in various scenarios is pretty awful though
>running on multiple systems without modification
Not for source, not for compiled. Writing strictly-standard-defined C is impossible and strictly-POSIX doesn't go too far.
>can be trivially ported to another platform
The platform-specific isolation in C is non-existing. Unlike in Rust or Go, there isn't such thing as that one module containing platform-specific stuff and everything else being platform-independent.
>runs on most popular platforms
C on Windows is hell, massive differences across all 3 main platforms (Windows, Mac, Linux)
so yeah, C is not good at portability
you're at that point where you're retarded
>portability is vague term that can mean too many things
not in this context. asm is processor family specific. c is, in any definition you would care to use, more portable.
>neither D nor F# are on this list
get out of here pajeet
user...
Literally nobody needs a reversed text file, is this the best defense linux has?
or python oneliner on any OS
gnu+linux
>Must replace all uppercase letters of a file to lowercase
>using GUI
Open your file in software
Open find and replace
select all "A"
replace to "a"
do it for all letters
>using linux
tr [:upper:] [:lower:] < input.txt > output.txt
>Stroustrup: Well, one day, when I was sitting in my office, I thought of this little scheme, which would redress the balance a little. I thought ‘I wonder what would happen, if there were a language so complicated, so difficult to learn, that nobody would ever be able to swamp the market with programmers?
>Stroustrup: It was only supposed to be a joke, I never thought people would take the book seriously. Anyone with half a brain can see that object-oriented programming is counter-intuitive, illogical and inefficient..
harmful.cat-v.org
>he's too dumb to learn C++