Anonymous
is it a good idea or practice to use typedef pointer ? typedef struct structure * Structure;
BinaryByter
the ram read size - for example - is still 8 bit
klimi
Hm
klimi
And
Anonymous
Hi
B K Sachin
Can anyone explain call by value and call by reference in c ?
Anonymous
Can anyone explain call by value and call by reference in c ?
Could be googled but oh well... Call by value passes a copy. Mutations do not affect the original element. Call by reference passes a the address of the item. Mutations do affect the original item. Efficient if address being passed contains a very large object
Mat
Yes
Don't know if it is a good practice or not, but it's not that big deal
Anonymous
https://stackoverflow.com/questions/750178/is-it-a-good-idea-to-typedef-pointers?fbclid=IwAR3BYZTtlzybn02QwxK2xPo2fgU-1pfpxUqf2MgcqjWuhNNxZQiEPP7BW7s
Dima
nothing is wrong with that except that it may confuse other devs
Dima
name typedefs like MyDataPtr;
Asdf
nothing is wrong with that except that it may confuse other devs
I know a lot of devs, and this get confused with very simple things.
Dima
yeah you better write *
Ǝlmar
Ǝlmar
can anyone please explain padding in this case here^
John
what do you mean padding?
Ǝlmar
structure padding
Ǝlmar
how does it occupy 72 bytes in memory?
BinaryByter
what do you mean padding?
its when the compiler creates extra bytes in a struct
BinaryByter
how does it occupy 72 bytes in memory?
the compiler adds a few extra bytes in structs in order to make the elements aligh on 4byte boundaries in order to increase performance
Ǝlmar
i want to know how this happens in the case above
Ǝlmar
i calculate 50+2 padding +4+2+2 padding+8
Ǝlmar
which makes 68
Beast
Hey guys ...I am facing trouble in store very very large number in order of 1000^1000... What should I do...
BinaryByter
use gmp
Beast
What gmp
BinaryByter
BinaryByter
its a library
Dhaif
Dhaif
Beast
Or
Beast
Okyy
Anonymous
Hlw
Vidhya
Hi
Anonymous
Hy
Anonymous
Hi, I'm a software engineer from China.
Anonymous
Is it possible to have a pointer which points to another pointer which points to another pointer which points to another pointer Eg int p=5; int *x =&p; int y=x; int *z=y; int ****w=z; int *a=w;
Anonymous
Sorry some of the asterisk didn't appear
Roxifλsz 🇱🇹
Sorry some of the asterisk didn't appear
If you post code on telegram you should surround it with ``` that way your code won't be interpreted by telegram as markdown syntax
Anonymous
OK
Anonymous
Thanks
Anonymous
Just curious to know if anyone will use this in a real world application
Anonymous
And the reason for that
Ariana
If you have like really weird tensor stuff yeah
olli
Is it possible to have a pointer which points to another pointer which points to another pointer which points to another pointer Eg int p=5; int *x =&p; int y=x; int *z=y; int ****w=z; int *a=w;
int i = 0; int *ip01 = & i; int **ip02 = & ip01; int ***ip03 = & ip02; int ****ip04 = & ip03; int *****ip05 = & ip04; int ******ip06 = & ip05; int *******ip07 = & ip06; int ********ip08 = & ip07; int *********ip09 = & ip08; int **********ip10 = & ip09; int ***********ip11 = & ip10; int ************ip12 = & ip11; is perfectly fine, the upper limit is actually implementation defined.
Ariana
lists of lists of lists of...
BinaryByter
lists of lists of lists of...
pointers to pointers to pointers to...
BinaryByter
lol xD
Anonymous
With the right amount you might be able to exhaust available resources
BinaryByter
No
BinaryByter
pointers are always 64 bit wide
olli
SHOULD we use that?
Of course not, if you ever need more than three levels of indirection I would suggest to think of your architecture again
olli
I think misra also prohibits anything above 3 levels of indirection
BinaryByter
misra?
olli
https://en.wikipedia.org/wiki/Motor_Industry_Software_Reliability_Association
olli
The produce guidelines for the software developed for electronic components used in the automotive industry.
olli
But in general, I feel their guidelines are actually quite useful
BinaryByter
oh
BinaryByter
okay
olli
Note 9025: More than two pointer indirection levels used for type 'int ***' [MISRA 2012 Rule 18.5, advisory]
BinaryByter
where can I read the misra rules?
olli
you probably need to buy it
BinaryByter
oh
BinaryByter
why do you have it then?
Mihail
It's £15
olli
The thing is, there are actually some free checkers, there is even one online (the one i took the text from). I read once only the rule description/content might be protected
Mihail
Also they seem to call it a standard for crucial systems, so not only motor industry
Anonymous
is there something wrong with my header file ?
olli
is there something wrong with my header file ?
No but you should link the implementation, the header does not contain any