MRT
I would use 128 bit pointer to 256 bit, than casting it
How can I do this with bit operators?
\Device\NUL
yes,Actually I want to change the second 128 bits
I will give you an example int32_t n; it's basically int16_t n[2]; If i want to change the second 16 bit int32_t n; int16_t *ptr = (int16 *)&n; ptr[1] = 0; Or you could try manual casting *(int16_t *)&n + 16) = 0;
\Device\NUL
i worked on uint, Is it different? ?
Actually there's no unsigned and signed types. It depends how you treat it. if (UINTMAX_MAX == -1) will give true output because the bits compared are same
Ludovic 'Archivist'
Oooh thought its C, i find it easier
You find it easier in C? It's like 5 lines of C++
Ludovic 'Archivist'
That doesn't depend on libc. the man pages has no relation with it. (There are some libc function that following standard and some that don't, malloc and calloc are on ISO C) malloc and calloc can fail and will return NULL, otherwise it's not following ISO C. they don't have any relation with specific OS or toolchain
Yeah, well, if we didn't use overcommiting Golang would be a very shitty language for example, and so would be most C++ stackful coroutines libraries (even if you could ship them with a kernel module that could handle that kernel side and do overcommiting for stacks only)
void
That doesn't depend on libc. the man pages has no relation with it. (There are some libc function that following standard and some that don't, malloc and calloc are on ISO C) malloc and calloc can fail and will return NULL, otherwise it's not following ISO C. they don't have any relation with specific OS or toolchain
I dont agree, on GNU it's not libc it is glibc and the related docs are provided by man pages. Yes malloc return null, but if malloc return a valid address it can fail too, so the check for malloc's return value is irrelevant due dependecy on Linux kernel variables setup. Later I looking for more infomation on: vm.nr_overcommit_hugepages = 0 vm.overcommit_kbytes = 0 vm.overcommit_memory = 0 vm.overcommit_ratio = 50
Hussein
the GNU C standard library is a C standard library
Hussein
every system has it’s own libc and on most of GNU/Linux systems the libc used in them is glibc
\Device\NUL
\Device\NUL
but GNU libc dont guarrantee the address returned by malloc
Okay sorry, seems like i reply the wrong person
\Device\NUL
the GNU C standard library is a C standard library
You still haven't answer my question tho https://t.me/programminginc/458355?thread=458347
Abdul Mobin
Hi anyone can solve this ??? int i ; int *a[5]; for (i=0 ; i<5 ; i++){ a[i]=rand()%100; } for (i=0 ; i<5 ; i++){ printf("%d\t",&a[i]); }
Abdul Mobin
i want to fill an array with random number and print it
Abdul Mobin
of course with pointers
\Device\NUL
\Device\NUL
You misuse pointer
\Device\NUL
Although you can store integer on pointer
Abdul Mobin
how i can do this
\Device\NUL
why
Pointer are used to store address
Abdul Mobin
Pointer are used to store address
you mean that i cant do this
Hussein
write ‘a[]’ as ‘int a[5]’
\Device\NUL
you mean that i cant do this
Yes you can, but the compiler will give you warns
\Device\NUL
Unless you explicitly casting it, and doesn't access the address the pointer pointed
void
now you run your program with gcc and it runs twice as fast in benchmarks compared to MSVC
I think i missing some messages or it went erased. glibc is very different (for example) than *BSD libc, and ISO C standard has a lot of "undefined behaviour" so two versions of libc ISO C compliant can have different results.
Abdul Mobin
???
\Device\NUL
Like toolchain, the assembly that generated from both compilers
\Device\NUL
So -> eat the ram -> eat the swap (making mess) -> kernel kills me
Sometimes kernel oom killer doesn't do its job with well
void
\Device\NUL
NT design is not following POSIX, thus it's not fair comparing NT with POSIX OS
void
posix sucks btw
void
:P
void
Telegram is making some mess with the replies?
void
lol
\Device\NUL
void
I need some rest 05.31 here, have a nice weekend!
Hussein
I think i missing some messages or it went erased. glibc is very different (for example) than *BSD libc, and ISO C standard has a lot of "undefined behaviour" so two versions of libc ISO C compliant can have different results.
first of all the gnu project has clearly stated that they consider POSIX they don’t obey them second of all glibc is POSIX compatible which means that you can use posix functions and you can use gnu functions
Hussein
???
int main() { int i ; int a[5]; for (i=0 ; i<5 ; i++){ a[i]=rand()%100; } for (i=0 ; i<5 ; i++){ printf("%d\t", a[i]); } }
Hussein
this is how it should be written
Abdul Mobin
this is how it should be written
i know this one but i want that one
Abdul Mobin
thanks alot
Hussein
what do you mean
Hussein
why are you using pointers?
Abdul Mobin
Hussein
it is a HW
what are supposed to do in your HW?
Abdul Mobin
what are supposed to do in your HW?
just this one to fill array and print it
Anonymous
#include <iostream> using namespace std; class B; class A { private: int numA = 10; friend int show(A,B); }; class B { private: int numb = 20; friend int show(A,B); }; int show(class A objectA,class B objectB) { cout<<"Showing no A="<<objectA.numA<<" B="<<objectB.numb; } int main() { class A objectA; class B objectB; show(objectA, objectB); return 0; } Output:- Showing no A=10 B=20
_
HELLO guys. Is it okay to make my home directory in Linux immutable using the chattr +i command? I just want to make it impossible to delete by mistake....
Hussein
just this one to fill array and print it
yes don’t use pointers for this unless you have to
0xJosh
Not necessarily that But I want someone to actually help me with my assignment 🙏🙏
Where do you get these assignments from? Did you sign up for an online coding boot camp? Or
Phlexy
Which school?
University
0xJosh
Ok
\Device\NUL
Misuse pointer
\Device\NUL
There's no address value on floating
Abdul Mobin
but why its work for chat
Abdul Mobin
char?
\Device\NUL
You should search pointer use case examples
SUMIT
Help to solve below question please 🙏 Write a C++ program to use pointer for both base and derived classes and call the member function. Use Virtual keyword.
You know me
can we say that is a sharing data amoung 2 classes with friend function?
friend does not share any data among the classes. They are given access to private data of individual class by defining them as friend.
Tran
who can draw a 3d robot using OpenGL c++, please?