Skip to content

Removed C++ warnings and unified C/C++ warnings flags #986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ for language, tools in languages_to_import.items():

Export('env')

env['CFLAGS'] = '-Wall -Wextra -Werror'
env['CXXFLAGS'] = '-std=c++17'
env['CCFLAGS'] = '-Wall -Wextra -Werror -pedantic'
env['CFLAGS'] = '-std=gnu99'
env['CXXFLAGS'] = '-std=c++17 -Wold-style-cast'
env['ASFLAGS'] = '--64'
env['COCONUTFLAGS'] = '--target 3.8'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ std::vector<double> backSubs(const std::vector<std::vector<double> > &eqns) {


void printMatrix(const std::vector<std::vector<double> > &matrix) {
for (int row = 0; row < matrix.size(); row++) {
for (std::size_t row = 0; row < matrix.size(); row++) {
std::cout << "[";

for (int col = 0; col < matrix[row].size() - 1; col++)
for (std::size_t col = 0; col < matrix[row].size() - 1; col++)
std::cout << std::setw(8) << std::fixed << std::setprecision(3)
<< matrix[row][col];

Expand Down
2 changes: 0 additions & 2 deletions contents/monte_carlo_integration/code/cpp/monte_carlo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ double monte_carlo_pi(unsigned samples) {
}

int main() {
unsigned samples;

double pi_estimate = monte_carlo_pi(10000000);
std::cout << "Pi = " << pi_estimate << '\n';
std::cout << "Percent error is: " << 100 * std::abs(pi_estimate - PI) / PI << " %\n";
Expand Down
4 changes: 2 additions & 2 deletions contents/split-operator_method/code/cpp/split_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void fft(vector_complex &x, bool inverse) {
}

void split_op(Params &par, Operators &opr) {
double density[opr.size];
auto density = std::vector<double>(opr.size, 0);

for (size_t i = 0; i < par.timesteps; ++i) {
for (size_t j = 0; j < opr.size; ++j) {
Expand Down Expand Up @@ -142,7 +142,7 @@ void split_op(Params &par, Operators &opr) {
std::ofstream fstream = std::ofstream(filename_stream.str());

if (fstream) {
for (int i = 0; i < opr.size; ++i) {
for (std::size_t i = 0; i < opr.size; ++i) {
std::stringstream data_stream;

data_stream << i << "\t" << density[i] << "\t" << real(opr.v[i]) << "\n";
Expand Down