Anonymous
nope the pointer isn't same as type
Anonymous
the pointer holds address to a piece of mem which has the type
olli
the pointer itself is a type but not the same type it points to
Mat
Pointers are variables
Anonymous
the pointer holds address to a piece of mem which has the type
but the pointer actually holds address which has the type always uint_64 afaik
olli
but the pointer actually holds address which has the type always uint_64 afaik
No! The size depends on your system. It might even be the same size as uint16_t
olli
I guess your running a x86_64 hence your pointer is 64bit wide
Anonymous
not the OS itself afaik
olli
ig it depends on the cpu arch in fact
No, running a 32bit system on a 64bit architecture you have only 32 bit
olli
This is the reason a 32bit application can only allocate 4GB ram at Max (2^32)
Anonymous
I think I dont get this question. The pointer is a type, ir for instance has the type pointer to int
the point is , why it didn't return the type of the ( supposed to point to ) location but returned the size of the type of the pointer itself instead even tho I was casting it back with * mark , if I was doing it without it , such a thing would be expected but while I am not , its kinda odd ?
olli
Abdulkader Which one are you talking about? void *p; sizeof ((int*)p); Does return the size of the int pointer, you cast the void pointer to a int pointer , but you do not dereference it. So this returns the size of a pointer Writing sizeof(*(int*)p) it returns the size of an int. Since you cast it to an int pointer an then dereference it
olli
It starts from 2^0 maybe. So 2^31
Still there are 2^32 valid values. Beginning at 0 up to 2^32-1
olli
ah , yeah true , now it makes sense
Once you understand it, it does make sense :) but it might take its time to get used to it
Anonymous
Once you understand it, it does make sense :) but it might take its time to get used to it
indeed , Ig am not done for now with pointers and stuff but gonna study some lisp tomorrow anyway while a friend has already recommended it , seems kinda pretty neat langauge
Anonymous
any thoughts about lisp btw ?
olli
any thoughts about lisp btw ?
I haven't come across a lisp project of interest, so I can't really comment on this
Anonymous
Welcome to C and C++
I really like them both even tho if they could get weird at somelevel and specially C could get rooted into lots of stuff like asm instructions , optimizations , drivers and etc , which idk a lot about them but at least trying to get used on C then I'll move to cpp which could also get weird al the level of the language structure itself , both are kinda able to being used in a complicated way afaik which I don't really love nor hate tbqh but ig its something I should deal with
Anonymous
C++ is less wierd if and when u learn from the correct and good sources
it could get weird at somelevel too with the templates and other concepts and the things could be kinda foggy at your head at somepoint if I am not wrong , not so sure about it but I've already hit some resources just with a fast look and the things wasn't as simple as java at all lol
Anonymous
even java could be easy (it just always makes sense) incompare to cpp cpp is more flexible and harder
Anonymous
I hope so , anyway , gonna sleep Gn everyone
Anonymous
and thanks for help
klimi
Hello my lovely snowflakes
Dima
klimi
Hello ^^
Isc
https://github.com/isc30/generic_optional
Anonymous
/saved
Anonymous
/saved
Bader
Hi guys!
Bader
C++ Noobie here, learning a bunch!
Bader
been watching cherno's vids
Isc
/saved
Zero
#cpp
Manish
/saved
Mat
We have an Off Topic group for those things
Md. Farzan
👍
Danni
How to add max min value on stack using linked list?
Anonymous
Kindly help How can i create a txt file in c++
Mat
Kindly help How can i create a txt file in c++
http://www.cplusplus.com/doc/tutorial/files/ Internet is full of wonders
Anonymous
hello!
Anonymous
in the libreoffice code, i found this: template<typename... Args>, what could ... mean?
Anonymous
the name of the typename?
Dima
three dots are template arguments
Dima
hence 'Args'
Anonymous
but the identifiers couldnt contain . characher in c++, right?
Anonymous
for example variable names could contain only letters, numbers, and _
olli
in the libreoffice code, i found this: template<typename... Args>, what could ... mean?
In this case the three dots represents a variadic template / parameter pack. As with template< class... Types > class tuple; it allows you to pass an arbitrary number of types. You can do std::tuple<int> but also std::tuple<int, int> and so on You are right, an identifier cannot contain a . charachter
Anonymous
thank you!
BinaryByter
Hello
Anonymous
Yh
Otumian
#cpp
BinaryByter
!yeH
klimi
Hello
welcome Maxi
klimi
hey Lulzx
Mohammed
Hi How can I convert a string to int in C++?
klimi
like digits?
Mohammed
Yes
klimi
how did you get such input?
Mohammed
I have a number string And I wanna convert it to integer
BinaryByter
Anonymous
why not? it works
BinaryByter
it works
BinaryByter
but it's C
Mat
http://www.cplusplus.com/reference/string/stoi/
BinaryByter
using C in C++ is just bad
BinaryByter
use std::stoi (std::string);