MᏫᎻᎯᎷᎷᎬᎠ
I see this conversation is getting very old any way
...
It was just like How does your inner voice pronounces the -> in C++?
inner voice? i don't have that. and as far as i know, only every 2nd person or so even reads with a voice in their head, idk, i'm not one of them
Anonymous
Which greedy algorithm to use?
There is no specific greedy algorithm. Greedy algorithm is a term used to refere to those algorithms which take the most optimal choice in each step. Read up on it.
Anonymous
Didn't someone just recently tell you that this is Undefined Behavior and ask you to read about Sequence Points?
Anonymous
Just don't use such peace of code. This is an example of undefined behavior (before C++17 standard, in C it's still UB). Different compilers may output 21 or 22
Anonymous
But there could be compilers that could just smoke your screen and there could be architectures where this code can cause a trap representation. Just because the online compilers that you tried gave you 22 as an output it doesn't mean they will give you 22 as an output everytime. It is Undefined Behavior.
Anonymous
This is Undefined Behavior in C++17 as well.
I'm pretty sure this is not undefined behavior in C++17 standard. Before P0145 was adopted (C++17) the code like this was undefined behavior.
Anonymous
I'm pretty sure this is not undefined behavior in C++17 standard. Before P0145 was adopted (C++17) the code like this was undefined behavior.
You are wrong. It is Undefined in C++17 and in C++20 as well for this reason: "If a side effect on a scalar object is unsequenced relative to another side effect on the same scalar object, the behavior is Undefined. If a side effect on a scalar object is unsequenced relative to a value computation using the value of the same scalar object, the behavior is Undefined." So j = (i++) + i; is Undefined as is j = (i++) + (i++);
Alex
/get cbook
Anonymous
https://imgur.com/a/vKUKugn is loading fonts at half resolution and upscaling a good strategy for reduced memory usage?
_dvd
Hi everyone. I cannot understand why this code fails reading signed 16 bit integers from a binary files using istream_iterator. The program has no errors but at the end of the execution the vector v is empty. If I try to read chars, it works fine. Here's the snippet https://pastebin.com/s0waHMYA
_dvd
You should be using std::copy
also with copy it doesn't work
_dvd
the iterator cannot read anything different from a char
Anonymous
Hi everyone. I cannot understand why this code fails reading signed 16 bit integers from a binary files using istream_iterator. The program has no errors but at the end of the execution the vector v is empty. If I try to read chars, it works fine. Here's the snippet https://pastebin.com/s0waHMYA
istream_iterator uses operator>> which is used for formatted input/output operations. I didnt realize that you are using binary formats. istream and ostream iterators work with formatted input/output. They cant be used with binary file formats.
Anonymous
Oh, I wasn't aware of that So there's no way to read from a binary stream into a vector using one of the standard function like for_each or copy?
Nopes. Not with binary file formats. If you want to be working with binary formats, you should be using the low level unformatted operations like put, get, read, write and so on.
Anonymous
https://gist.github.com/mgood7123/6d2ff26cb41d297dd28968bc24a8355a is this suitible for a texture atlas optimization?
Anonymous
updated gist
Anonymous
hey, I want help for open source, I see an issue but from where can I contribute? and how to talk with the community of that project ?
zelika
https://pastebin.ubuntu.com/p/RVKHZGg8tV/
zelika
tictactoe.cpp: In function ‘int main()’: tictactoe.cpp:10:14: error: expected unqualified-id before ‘.’ token TicTacToe.init(); ^ tictactoe.cpp:11:14: error: expected unqualified-id before ‘.’ token TicTacToe.start(); this is the error. but i saved the file. why it's giving the old version's error? what is my fault?
zelika
btw im beginner. so i didnt understand
~Maverick
Send the code
Anshul
How to identify why am I getting a SIGSEV
Pavel
How to identify why am I getting a SIGSEV
If you know how to reproduce it, you can build your app in debug mode (with symbols generated), then run it in the debugger and when it crashes investigate the callstack for the hints of why it could have happened
Pavel
I'm not buliding any app. And I never used a debugger, can you help me get started with debugger
You need to google instructions of how to use debugger with your IDE (or a console debugger available for your platform/compiler if you don't use any IDE)
Pavel
it didnt work.
Can you show your code?
Anonymous
it didnt work.
Without seeing your code we can't help you much.
zelika
which one? xox_game?
Anonymous
which one? xox_game?
Yes both the header and cpp file
zelika
okey
zelika
https://pastebin.ubuntu.com/p/B7KT97RmnB/
zelika
i didnt finish yet. so there is so many mistake
Anonymous
https://pastebin.ubuntu.com/p/B7KT97RmnB/
First of all TicTacToe is a class. So you can't use the . operator to call static methods in it. You should instead use :: Secondly there is no static init or start method in TicTacToe class. So how do you expect those calls to compile?
zelika
oh i understood thank you ^^
Moseh
Glad to be here @MissRose_bot
Mahin
Glad to be here @MissRose_bot
🤣🤣 she is everywhere
king king
Hi, i saw it in an article CC = gcc # Flag for implicit rules CFLAGS = -g # Flag for implicit rules. Turn on debug info # Define a pattern rule that compiles every .c file into a .o file %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ but it is just now working
king king
https://makefiletutorial.com/#automatic-variables-and-wildcards
king king
if someone knows about it , please give me a hint
Anonymous
if someone knows about it , please give me a hint
What is it that you want help with?
king king
what am i doing wrong
king king
shahar@Asus:~/git/c/makefile/practice$ ls ff.c Makefile qq1.c qq2.c shahar@Asus:~/git/c/makefile/practice$ make make: *** No targets. Stop.
king king
i copy this directly from the article
king king
Let's start with an example first: # Define a pattern rule that compiles every .c file into a .o file %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
king king
Hi, i saw it in an article CC = gcc # Flag for implicit rules CFLAGS = -g # Flag for implicit rules. Turn on debug info # Define a pattern rule that compiles every .c file into a .o file %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ but it is just now working
this is my makefile: CC = gcc # Flag for implicit rules CFLAGS = -g # Flag for implicit rules. Turn on debug info # Define a pattern rule that compiles every .c file into a .o file %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
Anonymous
Let's start with an example first: # Define a pattern rule that compiles every .c file into a .o file %.o : %.c $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
You have not defined a default target in your make file. The rule that you have is just for compilation. You also need one for linking. Also what exactly is CPPFLAGS? You havent defined it
Osama
Is there any alternative to Boost DLL?
king king
You have not defined a default target in your make file. The rule that you have is just for compilation. You also need one for linking. Also what exactly is CPPFLAGS? You havent defined it
but i thought my target is the .o files ? shuld i define a default to be a specific file ? do i have to have a rule for linking although i only want .o files ?
Anonymous
but i thought my target is the .o files ? shuld i define a default to be a specific file ? do i have to have a rule for linking although i only want .o files ?
If you want just .o files then you dont need to link them. Specify a default target then so that make knows what to do. Without a target, you willjust get the error shown above. So assuming you have to build 2 object files : a.o and b.o you can do this: CC = gcc # Flag for implicit rules CFLAGS = -g # Flag for implicit rules. Turn on debug info OBJECTS = a.o b.o all: $(OBJECTS) # Define a pattern rule that compiles every .c file into a .o file %.o : %.c $(CC) -c $(CFLAGS) $< -o $@
Anonymous
Sir, thank you very much for your kind help and explanation last qs, if i want to do it to all .c files is it possible ?
Yes but that would be slightly more complicated CC = gcc # Flag for implicit rules CFLAGS = -g # Flag for implicit rules. Turn on debug info SRCS=$(wildcard *.c) OBJS=$(SRCS:.c=.o) all: $(OBJS) %.o : %.c $(CC) -c $(CFLAGS) $< -o $@
Osama
Is there any alternative to Boost DLL?
Please Could someone help me with this
Anonymous
Use google
Anonymous
Please Could someone help me with this
If you don't want a portable solution, you can just fallback to the support that your OS offers like dlopen and so on
nelsenn
Guys good evening
Anonymous
No, I need a cross platform solution
WHy cant you use Boost.DLL then?
nelsenn
i wanted to know if any one could help me with this.... Please how do put a loop number(example from 1 to 10) into an array that has the size of the number of looped items
Kun-Mo
hi guys I need to reverse print a sentence I received from the user, using pointer and function and its my code: https://paste.ubuntu.com/p/ng4tkqDrbD/ can you help me fix it please?
Atropos
thank you so much
You're welcome :)
Roy
Any Modern C++ members
Anshul
In a video lecture, I saw that this was done. strtok((char*)s.c_str," ") s is a string. Here why can I typecast a const char* returned by c_str method to char*
ꍏꈤꀸ
In a video lecture, I saw that this was done. strtok((char*)s.c_str," ") s is a string. Here why can I typecast a const char* returned by c_str method to char*
it's cheating. Changing a constant type is Undefined behaviour. But in your example, strtok takes as a first parameter const char *, so it won't be affected ( behaviour is defined)
Anshul
Okay
Captain
Can anyone tell me how does range based for loop works with array of pointers Suppose i have an array of pointers which has pointers pointing to integers. for(auto a:array) *a = 0; All the elements will become zero. But by default range based for loop(without reference) passes copies right. Then how did it affect the real ones?