Alex
hi. inline means recommendation(so compiler can ignore) to substitute every function call with each body. Thus, you increase memory consumption, but can gain more performance for small functions. Usage is quite rare, cause compilers are powerful today and know when to inline function body without any help from human
Hermann
Hermann
I'm trying to simulate the error
https://pastebin.com/05SKG59N
Sathiya
Is any synchronisation method available for named pipes. In a thread, 1) created fifo file using mkfifo() 2) opened the file for using open(),flagO_RDONLY 3) in a loop, read() the file 4) closed the file And I have multiple separate api to write in fifo file. 1) here, opened the file with flag O_WRONLY 2) write the file and closed it. Can I use file lock or any other locking mechanism. To prevent race conditions
piggyho
i should google to calculate what????
it is showing how efficient algos are. for example, if you have a list of n numbers and you want to find the smallest best case is the number is the 1st you look at and worst case in n if it is the last number. the ave case would be n/2. if you double the amount of numbers then the ave case would be 2n/2. in other words the amount of elements travesered to find the smallest increases lineally or O(n) for a tree, every branch divides the search by 2 and it works out mathematically to be O(log2(n)) log base 2 the number of times the algo has to visit elements in the search increases by log2 of the number of elements see: https://www.bigocheatsheet.com/ and read the wikipedia pages on computer algos hope this helps
Nils
how to check if a variable == "one of the following:"?
Nils
So that I can avoid these many ||
Nils
So that I can avoid these many ||
like in python: if x in [1, 2, 3]
Nils
like in python: if x in [1, 2, 3]
which checks if x is 1, 2 or 3
Anonymous
which checks if x is 1, 2 or 3
std::is_any_of(std::begin(numbers), std::end(numbers), x); Where numbers is an array or a vector or any other container with numbers you're checking with
Dima
Lol
Sathiya
I have multiple write function and single read function. Didn't used O_NONBLOCK flag, it may cause ' a partial write' on pipe buf. I haven't faced any race conditions with my current implementation. But I would like to add any locking mechanism, to write a safer code. Can we add mutex or file lock for named pipes?
piggyho
what was that about O_NONBLOCK why do you recommend that flag not sure what you mean about proper closing
piggyho
ok, thx
Nils
how do I convert a decimal integer in a string to a bitset?
I_Interface
how do I convert a decimal integer in a string to a bitset?
1st convert it for double 2nd convert in to bitset
olli
Please don't "Unless otherwise specified, the behavior of a C++ program is undefined if it adds declarations or definitions to namespace std or to a namespace within namespace std."
olli
if it would depend on a user defined type, which std::vector is clearly not - see [namespace.std] using ADL with std::begin (and swap) helps :)
olli
> ADL lookup wont work if the container is not in the std namespace It does, doesn't it? This compiles just fine #include <iterator> #include <algorithm> struct Foo { int x = 4; int* begin() { return &x; } int* end() { return &x + 1; } }; int main() { Foo f{}; std::for_each(std::begin(f), std::end(f), [](auto x){ std::printf("%d\n", x); }); for (const auto& x : Foo{}) { std::printf("%d\n", x); } }
olli
so you're saying you're allowed to change the behavior of std::begin<std::vector<T>> ? I don't see how the standard allows this
MᏫᎻᎯᎷᎷᎬᎠ
Yeah Whatever you are saying olli is always right :D🕺
LORD
How can i stream gdrive video on my android , any app for this purpose?
NEWTON
Guys am new here
NEWTON
Hi
Yes
NEWTON
Please I want to know more about programming
NEWTON
Step by step
NEWTON
Can u help
klimi
You could find some videos online or you could read a book :)
NEWTON
Ok
NEWTON
Which books that
klimi
/saved
NEWTON
Ok
klimi
#cppbookguide
klimi
#cs50 And actually there is very nice course made by Harvard's university which is free
NEWTON
#Wow It helped thanks
klimi
#Wow It helped thanks
You're welcome :)
piggyho
/saved
Anonymous
#best-book
Anonymous
#best
Anonymous
#cbook
Anonymous
#learn
Anonymous
#rose_as_my_girlfriend
Chirag
#howtopostcode
Chirag
#imhacker
Tokin
Is it just me or rose reminds me of Jojo characters
Shubh
how to print "hello world" in center for
Shubh
c language
Q
c language
Which IDE are you using?
Q
If you are using turbo c Then you can print it after using Gotoxy(x coordinate, y coordinate) function after passing the centre coordinates of your screen
Q
If you are using turbo c Then you can print it after using Gotoxy(x coordinate, y coordinate) function after passing the centre coordinates of your screen
Or use printf("%11090s", "hello world"); Increase or decrease 11090 according to yr screen
Raziyeh
hi im questin: dArray resd 20 meaning a "20 bit" saved to bss section?
MᏫᎻᎯᎷᎷᎬᎠ
Artöm
masm
MᏫᎻᎯᎷᎷᎬᎠ
Ohh Cool
Raziyeh
masm
I am currently reading a book, I did not install the assembler
Raziyeh
are you sure? Byte?
Artöm
Certainly not bit
Artöm
Neither stack nor registers can store bits
Raziyeh
Neither stack nor registers can store bits
That's right- you are talking wisely
Artöm
Masm reference has notion of bitfields, but I think its a different thing
Raziyeh
im see: http://www.c-jump.com/CIS77/ASM/DataTypes/lecture.html
Artöm
masm
I was wrong, it's nasm
Artöm
resd is like dd but for uninitialized
Anonymous
Hi
Anonymous
Write a program that gets a natural number N (N ≤ 1000) at the input, then a sequence of whole N elements. As a result, the program must display the number of elements different from the last element in the sequence. Use array to solve the problem.
Anonymous
I have such a task who will help
olli
I have such a task who will help
have you read the rules?
Anonymous
#include <iostream> int main() { int N; std::cin >> N; int arr[1000]; for( int i = 0; i < N; i++){ std::cin >> arr[i]; }
Anonymous
yes
Anonymous
so far I wrote correctly
Anonymous
"the number of elements different from the last element"I am not writing correctly
Anonymous
??
olli
"the number of elements different from the last element"I am not writing correctly
you basically have to iterate over the array again and print count all the numbers where arr[i] != arr[N - 1]