/
std::ifstream rom( file_name, std::ios::binary | std::ios::ate ); if ( !rom.is_open() ) { return -1; } rom >> memory[rom_mem_start_addr];
/
is it copying the full content of rom into the array?
/
and why is open returns no while the file exists
Map
What's is the importance of std:: in c++?
Ludovic 'Archivist'
What's is the importance of std:: in c++?
std is the namespace for the standard library. It is a pretty important part of C++ as it both exposes tools to be used with the language and actual features of the language that cannot be expressed without it
/
help
Владислав🇺🇦
It was a link to cppinsights................
Roxifλsz 🇱🇹
Yeah, bit of a false positive
Roxifλsz 🇱🇹
original message: Hello. I bumped into a strange but rather useful behavior of templates that I cannot fully understand. Here is the code: https://cppinsights.io/s/9a2ff470 Why does not compiler complain that EValues enum class is private within the template's context?
Владислав🇺🇦
Thank you
Anonymous
original message: Hello. I bumped into a strange but rather useful behavior of templates that I cannot fully understand. Here is the code: https://cppinsights.io/s/9a2ff470 Why does not compiler complain that EValues enum class is private within the template's context?
@m11yy Why would the compiler complain? You are accessing EnumValues through the map. The map is already exposing it and the map is public. You are just using the interface of this map.
Владислав🇺🇦
@m11yy Why would the compiler complain? You are accessing EnumValues through the map. The map is already exposing it and the map is public. You are just using the interface of this map.
I am not sure why enum class itself is available inside the template function. Is it instantiated “inside the constructor”?
Владислав🇺🇦
I mean, in the end we anyway have to create an optional of type EValues, but this type is private and the optional itself does not seem to be located in the scope pf the class
Ludovic 'Archivist'
original message: Hello. I bumped into a strange but rather useful behavior of templates that I cannot fully understand. Here is the code: https://cppinsights.io/s/9a2ff470 Why does not compiler complain that EValues enum class is private within the template's context?
Unlike in a language like C# where accessibility is a property of the thing (class, method, attribute...) meaning that it is contagious, in C++ accessibility is a property of the name. The name EValues is inaccessible, but you can still receive EValues, you can however not build them as such directly.
Ludovic 'Archivist'
How can I google it to learn more?
https://en.cppreference.com/w/cpp/language/access > The name of every class member (static, non-static, function, type, etc) has an associated "member access". When a name of the member is used anywhere a program, its access is checked, and if it does not satisfy the access rules, the program does not compile
Ludovic 'Archivist'
Notice how it says that *the name* has an associated access
Ludovic 'Archivist'
How can I google it to learn more?
I would recommend that when you have a question on some C++ concept you do a search with the site specifier on google, for example like so: site:en.cppreference.com accessibility
Ludovic 'Archivist'
Like so, it only gives results on the site you search on, and cppreference generally has most of the answers about the standard
Koxy
Is C a high level language or low level
Dima
it really isnt hard to google lol
Gionny
Hello, is there anyone who has ever used milu? Is a software to do mutation testing in c
Gionny
I have a problem and I don't know how to fix it
Michel
Hi, anyone with CUDA knowledge can help me here?
void
ASM is low level
Hermann
how delete last element in unorder_set? iterating all elements?
Dm
Have someone worked with stat() function to Get File Information? <sys/stat.h> library. I stuck and don't understand why I am getting almost the same modification time for each file on my PC? ls -la returns different time stamps. stat return time_t time and I convert it with ctime and print.
Daulet
how delete last element in unorder_set? iterating all elements?
https://stackoverflow.com/questions/61482646/access-last-element-of-unordered-set-in-c
Дон
How to dereference a some element of two dimensional array?
Daulet
How to dereference a some element of two dimensional array?
Two dimensional? Is it vector<vector> or pointer **
Dm
Plz show code
https://pastebin.com/53ZJV0cF line 100-103 only int ls function matter
Dm
Why you not use ctime?
It's doesn't matter. The issue still exists if I change this to ctime I just want my custom format (the same as in regular ls -la utility)
Hizmu(Vlad)
https://pubs.opengroup.org/onlinepubs/009696799/functions/stat.html
Hizmu(Vlad)
maybe he read normally for the first time, and then returns you -1, but s does not overwrite
Dm
try to check that your stat does not return -1
Check it. It's works strange. Only some two directories pass this condition (. and ..) And also all information about files correct except the time
Dm
Try to move struct stat s; to global variables
I can try but I don't have any idea how it can help
Dm
maybe he read normally for the first time, and then returns you -1, but s does not overwrite
The value updates. I see it because access rights fully correct (the same as in regular ls -ls utility)
Daulet
The value updates. I see it because access rights fully correct (the same as in regular ls -ls utility)
char buf[512]; sprintf(buf, "%s/%s", path.c_str(), dent->d_name); stat(buf, &s);
Dm
you are genius
Daulet
Dm
I changed from this: while ((dent = readdir(dir)) != NULL) { if (l_flag) { stat(dent->d_name, &s); to this: std::string tempPath = path; while ((dent = readdir(dir)) != NULL) { if (l_flag) { tempPath = path + dent->d_name; stat(tempPath.c_str(), &s); and now it's works fine.. I don't know why i didn't understand this before by mw own. Anyway you helped me a lot. Thank you :)
Dm
lol. i searched for answer some time. found too much stackoverflow. okay maybe my googling skill is really poor :)
Дон
Two dimensional? Is it vector<vector> or pointer **
int array[10][10]{}; array[2][0] == dereference via pointers
hygge
is there a Csharp group?
sushi
class container { public: std::string Name; int Quantity; double Price; int sum = 0; int Total() { return Price * Quantity; } int TotalAmt(container** containers, int n) { int sum = 0; for(int i=0; i<n; i++) { sum += containers[i]->Total(); std::cout<<TotalAmt<<"Total Amount:"<<std::endl; } return sum; } }; HOW AM I GONNA MAKE THE TOTAL AMT WORK IN ORDER TO OUTPUT THE SUM
Anonymous
What is #define _GNU_SOURCE_ ?
Ivan
clang --version clang: symbol lookup error: /usr/lib/libclang-cpp.so.14: undefined symbol: _ZN4llvm9MDBuilder25createRTTIPointerPrologueEPNS_8ConstantES2_, version LLVM_14 Why this happens ?
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
What is #define _GNU_SOURCE_ ?
You get access to a lot of gnu extensions, functions etc. Also you'll have gnu tools from c code like mount, basename, ifconfig.
Rajeev
Is anyone online? I'm facing with a compilation error. Please help me
klimi
Is anyone online? I'm facing with a compilation error. Please help me
Instead of this message you could have sent your problem
Rajeev
I can't send photos here because I'm coding in pc
klimi
I can't send photos here because I'm coding in pc
Sending photos is forbidden as it was used to send bad quality photos of people screen which just doesn't make any sense at all
Rajeev
#include<bits/stdc++.h> using namespace std; template <typename T> void print(T x){ for(auto i:x) cout<<i<<" "; cout<<endl; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL); int arr[4] = {1 ,4, 5,3}; print(arr); return 0; }
Rajeev
error: begin was no declared in this scope...
klimi
because you are passing int * to the print function
klimi
but int * does not implement begin and end functions, so this is why the for cycle doesn't want to work
Dm
but int * does not implement begin and end functions, so this is why the for cycle doesn't want to work
Yeah range based cycles work with containers/classes which support iterators
Map
Can Someone please basically help me with the understanding of Double and Float I understand there all number with decimals point's. But somehow difficult to get the knowledge
Hermann
what does means thi serror? https://godbolt.org/z/5YbnsfM8T
Daulet
what does means thi serror? https://godbolt.org/z/5YbnsfM8T
Store() = delete, why you delete default constructor?
VantaSoft
Hi can someone please convert this few lines of c++ code to c#? https://github.com/mq1n/DLLThreadInjectionDetector/blob/master/DLLInjectionDetector/DLLCheck.cpp
o
what does means thi serror? https://godbolt.org/z/5YbnsfM8T
and add specialization for hashing, when you create unordered_set like this std::unordered_set<Base, MyHashFunctions>
fan
Hey! guys! Can somebody help me to solve this problem? https://stackoverflow.com/questions/73502557/how-to-forward-the-micro-args-to-format-func