I see that the atomic_flag is guaranteed to be lock free. A atomic boolean is not.
I'm trying to get an understanding when one should be used over the other. If one uses the atomic boolean should...
Type: Posts; User: CodeSlapper
I see that the atomic_flag is guaranteed to be lock free. A atomic boolean is not.
I'm trying to get an understanding when one should be used over the other. If one uses the atomic boolean should...
Nothing per se, other than are they battle tested logger or are there others that are aside from using something like boost?
I'm looking to use a logging class with a license that allows its free use.
I have looked at Easylogging, GitHub - easylogging/easyloggingpp: Single header only C++ logging library. It is...
I am using a mutex lock on the data I am using.
Here is my thought on the flag. If one thread is only reading it and the other is only going to make a decision when it is true, is a lock still...
I am working in VS2015 with C++11.
I have two threads going, and one is adding data to a queue. I have another function setting a flag of when i want to send all the data over. This variable is...
The calls to IX_xxxx are the vendor's drivers and I can't really change what parameters they need. It may make sense to make this a char*, since every driver I have worked with usually does that.
...
I'm working on making a class for an instrument I'm working with. This is done with a driver from the vendor.
Once I get the class done I will work on making some sort of GUI to see if my...
Ok, I used some of functions in the vector container library, a lambda function and the std::less function. The replies have been helpful.
There is a lot of syntax to learn in C++, that's for...
Thanks for the help, and I can get it to work like that, but I'm trying to get it to work more abstractly, if that is a word.
templates - C++ Get Vector type - Stack Overflow
They are using a...
The template at the top is giving me an error when I go to compile using the sort function. My guess is the compiler needs to know what data types are going to be used at compile time.
Is there a...
Start a timer and ignore input for 2 seconds or only take the last one entered? The code you have it a bit hard to follow what it is you want.
I added in using a template for SquareNumber. Coming from using mainly c for years, I'm finding this to be so cool.
// IntDoubling.cpp : Defines the entry point for the console application.//
...
I'm starting to practice using C++, and have read some info on using C++11 and am trying to use it a little bit.
I tried to follow the intent of the problem and did not use pow from <cmath>.
...
You can try that example with double and float and change the precision in the print statement to see how it affects the displayed value.
An array has more info to it than a pointer, hence why sizeof() works on it.
After this comment, you really should play entering different values on one of those online calcualtors and see how the precision varies.
You can try to print the long double in hex to see if the computer is printing it out how you expect. floating point - Convert ieee 754 float to hex with c - printf - Stack Overflow may give you some...
http://http://stackoverflow.com/questions/1674032/static-const-vs-define-vs-enum
This post discusses the benefits and cons of each method. It seems an enum would be the best option here.
Your...
Thanks for giving me some confidence.
I agree and avoid using #define if possible. It's better to use const int in this case since you can see the value while you are debugging.
I noticed you using the wrong format specifier for printing the sum and you had a index for Raindata. You might want to change sum to float, but I left it as an int since that's what you had.
...
Back when I graduated undergrad, 10 years ago I did some C++ for a CS minor. At work I've mostly done C with some small C++ projects.
I purchased Accelerated C++ and it's on the way. I'm...
I've been doing some reading on error handling, and I tend to use something like this at work when I'm working with various pieces of equipment, sockets, etc.
I would think this is probably...
See if this works for you. I got rid of the do while loop and made the variable names a bit clearer.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
...
Break the problem down.
1. You need to find the word Chapter.
2. You need to find the file ending position for Chapter (either another chapter or eof).
3. You need to copy the contents...