Indolent
Are you trying to use list[-1] or something?
I shouldn't be doing that that's why I have those ternaries
Nils
10 BTC, sure 🤣🤣🤣
Indolent
dp[i] = dp[i - 1] + i >= 2 ? dp[i - 2] : 1;
Mar!o
/report
Anonymous
Hi can I put a unicode pacman in a variable of type char? I tested but the character that appears to me is always a "?". I saw that you can put a string inside but I need a char
Igor🇺🇦
I shouldn't be doing that that's why I have those ternaries
What do you expect line if(str.at(i - 1) == '0') should do when i==0?
Ибраги́м
/ban
Alex
char is always one byte
is it in standard?
V01D
hi. you can`t, char is usually one byte. width ofunicode symbol pacman is bigger than one byte
it IS one byte. Where size begin to fluctuate is ints and longs on 32 bit systems
Anonymous
sizeof(char) == 1 is always true both in C and C++
Огни
Indolent
What do you expect line if(str.at(i - 1) == '0') should do when i==0?
It's all part of a bigger whole. I fixed what was wrong.
V01D
And sizeof (char mas[n]) == n
Hippity hoppity, your pfp is now my property ;D
void *
char is always one byte
But a byte is not always 8 bits wide
void *
Yes
So, theoretically it is possible to put an UTF-32 pacman in a single char on some DSPs
Vlad
And rads are more convenient imo
Vlad
It is
No, it's not. It depends on what you think the byte is. If it's a smallest bit of addressable memory then it can be anything, depending on the cpu architecture.
Andrew
When writing C is better to use uint or uint_t ?
Andrew
No mean the t sorry
Andrew
Uint vs uint_t
Andrew
Ok thanks
Mr.
Yes please
Anonymous
Hello everyone, i am 27 years old new with C and looking foward to make good contact. My goal of this is to build a bot to work with MQ4 language so i can make it work on the financial market ( Currency ) forex. If anyone want to chat in private or here let's do it.
olli
be aware that int32_t is optional and not available on every architecture while int is mandatory.
Angad
👍
vinícius*
vinícius*
it's available everywhere that conforms to C99+ or C11+
olli
optional kind of implies it's a GCC extension or something
no, but you can't guarantee availability because there are systems where a byte is not 8 bits and hence you can't have that type
vinícius*
the only case in which they don't exist is e.g uint64_t in an architecture that only holds up to 32 bits
vinícius*
it's entirely possible that sizeof(uint8_t) != sizeof(char) in some architectures
olli
the only case in which they don't exist is e.g uint64_t in an architecture that only holds up to 32 bits
what about PDP-8? how would uint8/16/32/64_t be available there? and whether these types exist or not are up to your compiler, GCC implements uint64_t even for 8 bit AVR cpus
olli
I highly doubt PDP-8 supports C99
which are the requirements does C99 pose on hardware?
vinícius*
which are the requirements does C99 pose on hardware?
None? But that's what I'm saying. As long as the architecture and compiler can conform to C99, these fixed-length ints will be there
vinícius*
if one's worry is that the code might be running on a PDP-8, then that's off the table, like basically everything else
vinícius*
for most people, that's a non-issue
olli
None? But that's what I'm saying. As long as the architecture and compiler can conform to C99, these fixed-length ints will be there
I feel you contradict yourself? you can write a C99 compliant compiler without support for fixed-length types
olli
no.. since that's part of being compliant
do you know what optional means? n1570 7.20.1.1 [Exact-width integer types] #3 These types are optional. [...]
vinícius*
they're stated as optional because they don't exist where they can't exist
vinícius*
#pragma once is optional, int32_t isn't
vinícius*
where does it say that?
right below what you copied. These types are optional. However, if an implementation provides integer types with widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a two’s complement representation, it shall define the corresponding typedef names.
vinícius*
that's a hardware-related limitation
vinícius*
Don't be obtuse. Any C99/C++11 compiler is expected to support them if they exist in the hardware. If you have a 36-bit architecture, you may not have int32_t.
olli
Don't be obtuse. Any C99/C++11 compiler is expected to support them if they exist in the hardware. If you have a 36-bit architecture, you may not have int32_t.
I have not said otherwise, I only pointed out these are optional and hence are not required independent of your target or underlying hardware.
olli
Sure, it's not really worth worrying about since linux and windows require 1 byte to be 8 bits and hence you practically won't find other hardware anymore - I just think it's worth mentioning :)
Talula
Do programmers work on Sundays? 🤔
No, our operating system is in Indexing mode I guess... (what kind of question is that)?
Recep
Do programmers work on Sundays? 🤔
it depends on who you work for and where you live, I have been never worked at weekends in my 7 years of career :)
Harsha [M]
!report
V01D
pendemic, lol
Garvine
How do u write a palindrome program
olli
The fixed size integer types are optional. (Although they exist in every major platform)
olli
No, int is mandatory and so is uint_fast32_t
olli
Sorry, it should have been uint_fast8/16/32/64_t And these are the fastest unsigned integer type with width of at least 8, 16, 32 and 64 bits respectively
Vlad
'cuz it's aligned to be fasta
olli
It depends what you want to do. If you want to make sure a type is big enough to hold certain values than the fast types are a good choice. If you need to have exactly 8/16/32/64 bits it's bad because you don't know the exact size
olli
Because it might be faster, e.g. the same registers could be used for 16 and 32 bits operations, when using 16 bits your compiler might need to use a more costly instruction that zeroes the upper half of the register
olli
I don't know your use case, so it depends
INDIA
WAP in CPP to define a class Employee with data members name, EmpID, age, gender, sal and department. Define member functions to read and display employee information. Define a friend which can display the details of employee with given EmpID. Also define constructors ( any two) and destructor for the class
Chinepun💛
I am trying to debug my code with gdb in VS code but I'm getting "Single stepping until exit from function main,which has no line number information".Can anyone please help me with the root of this problem?
Chinepun💛
you compiled everything with -g , all source files?
I used -o but it was just a source file,I will try -g now
Andrew
o is to specify the name output, but you have to put -g for debug info
Andrew
mean put both