Pavel
If I want to have a templated class and to create a typedef with exact parameter to use in the real cases of my application, what prefix or suffix for the templated class would you suggest to use? example template<typename TypeId> class EntityManagerT { ... }; template<typename TypeId> class EntityManagerViewT { using EntityManager = EntityManagerT<TypeId>; ... }; using EntityManager = EntityManagerT<int>; using EntityManagerView = EntityManagerViewT<int>; Here I use T suffix, but I guess there should be a name convention or something for such a case. I want the final typedef to be the name that is being used in the app, so I want to avoid any prefixes or suffixes there.
Anonymous
Impl?
Pavel
Like this? template<typename TypeId> class EntityManagerImpl { ... }; using EntityManager = EntityManagerImpl<int>; Feels inverted, but better than T at least :)
klimi
no, because this is c/c++ group, if you want to ask offtopic questions, go to the offtopic group. thank you
Anonymous
/warn off
Anonymous
Top
/get cppbookguide
Half Blood Prince
/get best-book
Half Blood Prince
#cpp
Yohana
Thanks
𝚕𝚊𝚒𝚗𝚋𝚘𝚝.𝚜𝚌𝚖 🇺🇬
#rose_as_my_girlfriend
Shahar
Little question about this code: char shellcode[] = "\xbb\x00\x00\x00\x00" "\xb8\x01\x00\x00\x00" "\xcd\x80"; int main(int argc, int **argv) { void (*ptr)(); ptr = (void (*)()) shellcode; (*ptr)(); return 0; } Why ptr is dereferenced at the third line of main in order to be called? As I understand, ptr itself is equal to a pointer pointing to shellcode variable casted to function pointer. So what's the effect of dereferencing it? Shouldn't it be called by ptr() and that's it?
Anonymous
Mercedes Antiq
Hi
Ehsan
Hi
read the rules
Anonymous
Is the cpp book by Bjarne Stroustrup recommend or not? I don't see it on the stack overflow recommendations page but it was on official isocpp site. Oh it's there, thanks.
professor
me again. I Have a workflow where I Have 4 models vendor, products, vulnerabilities , and exploits), and each model can receive multiples sources of data such as google, yandex, yahoo, etc as an example . I think based on this I need to create four pipelines , and multiples senders, what do you think on it?
Anonymous
?
Anonymous
Does derived class inherit the constructors of base class in single inheritance? If it does why can't I access the constructors of base class through derived class?
Anonymous
If you want to inherit constructors, write in the derived class: using base::base;
Anonymous
Where base is a name of a base class
Anonymous
Ubuntu is a distribution
Exact. The OS is Linux
Nameful
Exact. The OS is Linux
The kernel is Linux
Mercedes Antiq
read the rules
cout << "It seems that there are many actions not allowed." << "\n";
Mercedes Antiq
Hi from Panamá. My english is not ok
Anonymous
Hello, good morning
Anonymous
if I were to print to screen in C, using just macro and not having more than 32 characters... how do I proceed
Anonymous
assert()
🙏 thanks
Ammar
assert()
How come assert() related to printing function?
Anonymous
true... perhaps an example would do
Anonymous
How come assert() related to printing function?
how else can you print something by only using macros
Ammar
how else can you print something by only using macros
Hmm, it seems something wrong with the question.
Anonymous
well, macro functions can do... my problem is having the limits of 32 characters
Ammar
Well yeah, assert(0) would print fail message and abort your program.
Ammar
But what is it supposed to do?
Anonymous
Write a program that can print "Hello, World" followed by a new line. You are not allowed to use more than one line of code You are not allowed to use more than 32 characters in the file 101-preprocessor_abuse.c, including the documentation of your functions and the preprocessor directives You are not allowed to include other c files You are not allowed to include other header files Remember: your program should pass all Betty checks for style and documentation You don’t have to use the -pedantic, -Wall, -Werror, -Wextra gcc flags This program should be written in C and will be compiled with gcc
Ammar
main(){printf("a");} seems to be the solution.
Ammar
main(){printf("Hello World\n");} it is exactly 32 characters.
Ammar
the header #include stdio.h
Implicit declaration will cause printf to be int printf()
Ammar
So that's fine.
Shadow
Want data-structures- notes anyone having it?
Ammar
Though, it is bad. It may cause segfault if 64-bit pointer gets trimmed and lost its high part to 32-bit due to integer type juggling.
Anonymous
the compiler will print this, so idk if it counts
Abid
#include <stdio.h> int main(){ printf("Hello world \n"); return 0; }
Ammar
this is probably the solution
Could have been shorter with puts()
Anonymous
the header #include stdio.h
In C it's not necessary
Anonymous
101-preprocessor_abuse.c:1:8: warning: incompatible implicit declaration of built-in function ‘printf’ 101-preprocessor_abuse.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ +++ |+#include <stdio.h> 1 | main(){printf("Hello, World\n");}
Anonymous
thanks everyone...
Anonymous
I think it has to be a macro function but the limit of 32 characters is just my strain #define print(x)#x (puts(x)) main(){print("Hello, world")}
Anonymous
thank you all🙏
Anonymous
Yes... very true....
The Shadow Monarch
/get cppbookguide
Nishant
Anyone wants to learn C/C++ from University of California Berkeley?
Nishant
No
Nishant
Directly you can enroll from university website
Nishant
Looks like a scam
So don't judge without knowing
Anonymous
So don't judge without knowing
Dude write the whole thing
Anonymous
Or don't write at all
Abid
auto x = "This is a c-string"; decltype(x) y; Error: "x dose not name type" "x was not declared in this scope" What is the solution?
Abid
#include <iostrem> #include <typeinfo> #include <string> using namespace std; int main() { int i=47; const char * cstr = "this is the c-strin"; const string sclass =string("this is a string class "); auto x = "this a c-string"; decltype(x) y; cout <<"Type of i is " <<typeid(i).name()<<endl; cout <<"Type of cstr is " <<typeid(cstr).name()<<endl; cout <<"Type of sclass is " <<typeid(sclass).name()<<endl; cout <<"Type of x is " <<typeid(x).name()<<endl; cout <<"Type of y is " <<typeid(y).name()<<endl; return 0; } @unterumarmung