数学の恋人
that was one rude fellow sharing fake US bank accounts
klimi
Ah damn he came into offtopic
Anonymous
.
kartik
Hi
kartik
Need help sublime TXT 3 my code output terminal not prompt
kartik
Anyone who help
kartik
New to coding
kartik
Any help
Andrew
Sublime is not very good
SK
Do anyone have experience with python
Anonymous
What is that? I just sent link to the group rules!
Vlad
Nice virus. Approve 👍
Anonymous
The rules say not to post executables
Vlad
So you've decided to share your virus collection with us?
Vlad
I loaded up previous one in VM and my PC exploded
Anonymous
The rules say not to post executables
The rules say not to post executables * 2
Nazarova Muslibar
Nazarova Muslibar
Roxifλsz 🇱🇹
/warn someone needs to learn to read
Dima
Removed
Anonymous
Arkadaşlar bana sağlam bilgisayar önerebilir misin? Yazılım ve grafik için.
Phil
/get cbook
Vlad
Noluyor?
Read the rules. It is English only.
Anonymous
Sorry ok.
Brown
Why char *a = "some string"; is read only ? And why this doesn't work for array of ints ?
Ammar
char *a = (char *)"some string";
Ammar
No it's not
I often do that.
Vlad
I often do that.
And then write to that string?
V01D
Since we are talking about strings - which is safer (kernel wise): char str[100] = "String"; or char* str2 = "String2"; ?
Vlad
You can't write into it
Ammar
And then write to that string?
That is still readonly.
Ammar
Sorry, I didn't read the question carefully.
Vlad
That is still readonly.
Then why cast to char* tho?
Vlad
Leave it const char*
Ammar
Then why cast to char* tho?
Just to get rid compiler warning.
V01D
You can't write into it
Strings are immutable, I know. I meant which string implementation is safer
Brown
Okay, why doesn't this work for int of others?
Vlad
Just to get rid compiler warning.
I mean why this char* a = (char*)"asdf"; instead of this? const char* a = "asdf"
Brown
Array of ints, I mean. Int *p = {1,6,5}
Anonymous
Array of ints, I mean. Int *p = {1,6,5}
{1, 6, 5} is not an array of ints
Vlad
Array of ints, I mean. Int *p = {1,6,5}
int arr[] = {1, 6, 5}; You meant
Anonymous
{1, 6, 5} is not an array of ints
if you are using C++, this is an std::initializer_list<int>
Anonymous
int arr[] = {1, 6, 5}; You meant
that's just invalid syntax
Ammar
I mean why this char* a = (char*)"asdf"; instead of this? const char* a = "asdf"
Because I sometimes I have to assign "xxx" to char *. I may violate some best practice for that.
Ammar
As I remember, first time I saw the xdebug source code like that and it became my habit.
Anonymous
+1
Vlad
that's just invalid syntax
https://godbolt.org/z/8fP7bT
Vlad
It's as valid as it gets :P
Vlad
Even more so in C89 it was the only way to init char arrays
Anonymous
sorry
Brown
int arr[] = {1, 6, 5}; You meant
Yes but, if char *p = "something" I thought why not int *p = {1,24,7} since in both case p has given an address.
Ammar
writing invalid programs is not a good habit
Yeah, I am going to fix that habit.
Ammar
https://github.com/xdebug/xdebug/blob/78d25b202981376e1f343132299d79517888cfaf/xdebug.c#L517-L524
Ammar
That is what I meant.
Anonymous
Because I sometimes I have to assign "xxx" to char *. I may violate some best practice for that.
Lol Do you like writing error-prone code? char* str = (char*)"Hello, UB"; str[0] = 'F'; // oops, UB
Ammar
https://github.com/xdebug/xdebug/blob/78d25b202981376e1f343132299d79517888cfaf/xdebug.c#L517-L524
ZEND_STRL("_ENV") will expand to "_END", sizeof("_ENV") - 1
Brown
Second one is not valid
Why doesn't it work ?
Vlad
Why doesn't it work ?
Cause pointers are not arrays
Anonymous
Even more so in C89 it was the only way to init char arrays
yeye the pointer one was invalid syntax because {1, 6, 5} was not an array of ints. but the [] is correct syntax because each element of the array is initialised using the braced list.