Nomid Íkorni-Sciurus
Anonymous
Stanislav
Igor🇺🇦
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
(and anyway pointers do exist in Haskell)
zZackz
Ok
Hamid
Hello
NXiss7
Dart, nim, scala, kotlin are native too (yes, you can build a native binary without the bundled VM)
and they pretty much do the same you said here.
You can optimize the executables, access C++ libraries, write declaration libraries and compile everywhere (with the exception of Scala in this case)
If you write a hello world gui app with NIM (nimgui), it will be around 200 kb.
I know, and also use Dart for Flutter.
But they are more like a "workaround", and that's why (with another reasons to, ofc) C/C++ called "native"
NXiss7
NXiss7
There are lots of fields in programming.
C++ fits many, and mostly connected, necessary fields.
But not everywhere.
C++ is perfect as a "C with high level features", intermediate level language.
But try writing a monile UI with that, well... good luck...
NXiss7
You can't use one languahe on every area, but you can use C++ in many many areas pretty well.
Anonymous
Message from @nurlybekovnt:
How do I connect the #libpqxx library in the #CMakeLists file? There is a project where MySQL is used, I changed it to use PostgreSQL. First, I wrote a simple program using PostgreSQL, compiled it manually as " g++ main.cpp -std=c++17 -lpqxx -lpq". Then I changed the main project. But now I can't compile the project because I can't connect the libpqxx library to its CMakeLists. So I first created CMakeLists for the test program. In CMakeLists for a test project, if I add option "-m32"(to generate 32bit code), I get this error: "/usr/lib64/libpqxx.so: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status", if you do not specify it, everything is cool. But I have to specify it, because the main project has it. Installed libpqxx as " sudo yum install libpcap-devel.x86_64", not found in the repository for i686. https://gist.github.com/nurlybekovnt/d8b699125773ea8e998d109c12463c53
@h4cktill, I think you can help
Stanislav
Stanislav
it's illegal since C++11 )
András
It's ub
András
On the stack
Artöm
String itself is in static area. Local pointer to it is on stack
Nomid Íkorni-Sciurus
Rust?)
yeah, Rust as well
Nomid Íkorni-Sciurus
Nomid Íkorni-Sciurus
NXiss7
NXiss7
Yeah, I agree about this.
But there's to say that interoperability is a must nowadays. Dart, Nim, Rust, D, all of these do implement that.
I'm pretty sure you could do the same things you do in C++ with these languages.
Bro, many of these languages doesn't even expose memory, they manage memory by themselves.
Whatever, I don't want to argue about this anymore, you got my point, I got your point, we share a common point.
😄😄😄😁
NXiss7
Every language is translated into asm in the end, every language. That is the only language that CPU understands but it's really hard to read, write, use...
That's why languages like C/C++ exists.
C (compiler) directly compiles into asm code, then assembler assemles that file.
Francisco
You should definitely know how to read assembly, but not really write it
Khaleed
Yeah that's it but............
NXiss7
VM based languages like Java, C# use pseudo-asm (instruction sets) codes, when you write Java code it's conpiled to Java-asm instead of x86 asm. Then you install JRE and that translates Java-asm to native CPU asm.
Anonymous
👍
Francisco
I can read code in almost any programming language, and that doesn't mean I know how to write it
Mat
Where's the problem? You can be able to understand what every instruction in ASM do without knowing how to create a project in ASM
Igor🇺🇦
There is a difference between being able to generally understand the code from reading it and writing code. You can try yourself with small samples here https://godbolt.org/
Mat
I can read ASM, yep. I'm not able to create what I create with C++ or Scheme or Haskell or whatever with ASM
Francisco
Nope
Ajay
I've
string s;
s = function_that_returns_a_string();
I can't do
string s = function_that_returns_a_string();
What is the cheapest way to store the returned string into s without temporary allocations and deallocations?
Francisco
Syscalls let you request stuff from the kernel itself. The asm instructions are executed in the CPU, not in the kernel (if that even makes sense). The kernel just makes sure your program is loaded in memory and pass through the CPU
Igor🇺🇦
Does anyone know the state of 2017 parallel algorithm in different compilers? What's the support, what's the overhead, when should they be considered? I've seen just a bunch of articles and videos from 2017/2018 about how little support there is.
Igor🇺🇦
I'm interested in "good practices" and performance considerations
Ибраги́м
/ban banning also available
NXiss7
No, does system calls when required
Artöm
You need to learn pls to write first abd read second. You wouldnt want to write web server in asm
Artöm
And no, only compiled languages are compiled (duh). Eg you cant compile python or js to asm
Artöm
If you do it explicitly or library function does it. Syscalls are to be avoided when possible
Artöm
Artöm
You dont need it most of the time
Francisco
Artöm
Im a student
Igor🇺🇦
MeNotMe
I have a life hack for Y'all
So you know( i++) right?
Replace it with (i -=- 1).
Its symmetric and Beautiful😂😂😂😂
Asdew
Ajay
Artöm
yes.
Then initialization should work. Show full code
Artöm
Ajay
Then initialization should work. Show full code
string common_prefix_suffix(string &s, string &t){
int mx = prefix_function(t+"#"+s);//this just return an integer
//string ret = s;
//ret+= t.substr(mx,t.length()-mx);
return s+t.substr(mx,t.length()-mx); //Isn't this temporary alloc ?
}
Later the returned value is stored in predeclared string variable.
Artöm
Artöm
Ajay
I mean I've a pre-declared string variable s and during return from the common_prefix_suffix function, temporaries are allocated and deallocated.
Ajay
No need
But doing string &&s, won't it prevent copying?
Artöm
Theres no copying
Artöm
Copy will be elided. Worst case is moving, whuch us cheap anyway
Ajay
string s;
s = function_that_returns_string();
doesn't that cause copying?
Artöm
Thats move assignment
Ajay
Artöm
Read about move semantics, then about copy elision
Ajay
Ajay
Ajay
Ajay
👍