Ludovic 'Archivist'
Makes me very sad
Ludovic 'Archivist'
It means I cannot use coroutines in freestanding because libstdc++ doesn't support the clang intrinsics yet
Ludovic 'Archivist'
You also have stddef
Anonymous
It means I cannot use coroutines in freestanding because libstdc++ doesn't support the clang intrinsics yet
Coroutines are not meant to be user facing yet. The C++20 standard just defined the backbone structure. With C++23, full fledged support will be available and freestanding implementations hopefully will offer full support by then
Ludovic 'Archivist'
You also have stdlib, but only exit and stuff is declared
Anonymous
Then compile -nostdlib code with stdint.h header. Prove it in practice
Did you not see the link I provided? Do you think you know better than CPPReference?
Daulet
I... I do that everyday
Ok. I thinked that stdint.h has libc dependent macroses. I am wrong ok
Ludovic 'Archivist'
Coroutines are not meant to be user facing yet. The C++20 standard just defined the backbone structure. With C++23, full fledged support will be available and freestanding implementations hopefully will offer full support by then
I... I was trying to make such freestanding impl. I cannot because the things that C++20 is supposed to expose in freestanding doesn't work on LLVM+libstdc++
Ludovic 'Archivist'
Ok. I thinked that stdint.h has libc dependent macroses. I am wrong ok
It uses stddef tho iirc, which is also freestanding-OK
Daulet
It uses stddef tho iirc, which is also freestanding-OK
Is uintptr_t and size_t has different size in Real Mode?
Ludovic 'Archivist'
Is uintptr_t and size_t has different size in Real Mode?
If you want to use realmode, you will probably need to crosscompile for i186
Anonymous
Is uintptr_t and size_t has different size in Real Mode?
Their sizes is not defined by the standard. The standard requires size_t to be atleast large enough to hold 65535. But typically they will be the same size
Ludovic 'Archivist'
Is uintptr_t and size_t has different size in Real Mode?
Also, you will probably have legacy pointers in realmode, far and near pointers to be accurate
Ammar
I asked about that case
Emm... what did you ask?
Daulet
Emm... what did you ask?
Is it really that size_t and uintptr_t can be not same
Ludovic 'Archivist'
On systems with far and near pointers, pointers are generally 2*size_t in size
Ludovic 'Archivist'
It actually is the reason why std::allocator exists in C++
Anonymous
Is it really that size_t and uintptr_t can be not same
size_t is required to be only 16 bits long. On a 32 bit system uintptr_t will be 32 bits long. So yea it is possible that uintptr_t will be bigger than size_t. Typically they are the same size but this does not discount an implementation (the one being discussed where FAR and NEAR pointers are supported) where they can vary.
Ludovic 'Archivist'
On systems with far and near pointers, pointers are generally 2*size_t in size
But now we have cute pointers that can address the whole memory so no need for scrounging on pointer size
Anonymous
int getX() const {return x;} what is the purpose of const in this line?
Anonymous
int getX() const {return x;} what is the purpose of const in this line?
It means this method won't change the object pointed to by this pointer. The this pointer will be a pointer to a const in this method. So you can call this method on a const object. If you remove the const, you can't call this method using a const object
Peter
In this line of code printf("%2x", opc[i] & 0xFF);, what does the & operator do?
klimi
Binary conversion
binary conversion? O.o
Resul
Can you look that Post? https://stackoverflow.com/q/74089335/14686302
klimi
you are copying just one pointer, that's not your data
Deepak Chaurasia
binary conversion? O.o
Bitwise operators perform functions bit-by-bit on either one or two full binary numbers.
Khadija
And please if you have any sources of exercises … about time complexity big o notation , For more practice ..
Edoardo
Hi,I have a doubt about arrays: does it exist a way to pass a 2D array to a function with at least one variable dimension? For instance,I want the users to type the dimensions and then I would pass the array to a function
Edoardo
Got it,thank you so much
Steven
Hermann
how to start studying design patterns?
\Device\NUL
This is wrong. ptr[x] is *(ptr+x)
Yes, https://t.me/programminginc/441139
Anonymous
Yes, https://t.me/programminginc/441139
Not sure why you have linked that post. It doesn't contradict what I said.
Void
why i input p=helloworld and sizeof(p)=8 ?
Void
Yes
Talula
Yes
Pointer is always 8 byte long... if you want to get the length of the string use strlen(str);
Void
char *name[]={"Follow me"}
Void
Why it shows [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]🥲
Talula
char *name[]={"Follow me"}
#include <stdio.h> #include <string.h> int main() { char a[15] = "Hello world"; int l = strlen(a); printf("Length:%d",l); }
Talula
or char a[] = "Hello world";
Talula
What if i have to use char *a 🥲
*a would be pointer, you could do it like this...
Talula
#include <stdio.h> #include <string.h> int main() { char a[] = "Hello world"; char *b = a; int l = strlen(b); printf("Length:%d",l); } Where a is the array of char and b is pointer to that array.
Gain
why am i getting infinite loop in online compiler but it works fine on my system
Gain
ll solve(){ ll n; cin>>n; ll loo=n; ll a[n]; for(int i=0;i<n;i++){ a[i]=i+1; } cout<<n<<"\n"; while(loo>0){ cout<<n<<"\n"; for(int i=0;i<n-1;i++){ cout<<i+1<<a[i]<<a[i+1]<<"\n"; } cout<<n<<a[0]<<a[n-1]<<"\n"; loo--; } }
Руслан
What type of data allows you to make a = 1.5 a % 1 = 0.5? in C
klimi
What type of data allows you to make a = 1.5 a % 1 = 0.5? in C
none... you would need to use functions for that
klimi
Thanks
try fmod or something
Gain
what's ll?
#define ll long long
Boom
https://hastebin.com/okotoyujez.cpp
Boom
https://hastebin.com/okotoyujez.cpp
this is a program for linked list , and i have only written it till add function, and I am getting Segmentation error in VS code and Dev C++ but the program runs fine in online compiler, Please help me to know why is this happening!
Руслан
How int a => double b?
Anonymous
#include <stdio.h> #include <string.h> int main() { char a[] = "Hello world"; char *b = a; int l = strlen(b); printf("Length:%d",l); } Where a is the array of char and b is pointer to that array.
#include <stdio.h> int main(void) { unsigned int l = 0; char a[] = "Hello world"; char *b = a; while(*b != '\0') l++, b++; printf("Length: %d", l); return 0; } Using pointer arithmetic we can do the same thing without depending on the string header file.
Anonymous
You can find many solutions to the same problem in C.
klimi
You can find many solutions to the same problem in C.
in fact infinitely many solutions 😊 but some are more reasonable than others
Pankaj
What about sizeof
Pankaj
I think it gives only type size