Skip to content
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

Migrated from printf to std::cout && Removal of Using Namespace std; #293

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Astabol
Copy link

@Astabol Astabol commented Dec 28, 2024

Hello,

  1. Migrated from printf to std::cout.
  2. Introduced header iostream and iomanip
  3. Removal of using Namespace std

Tested from myside and its working!
Thanks

@nibanks
Copy link
Member

nibanks commented Dec 30, 2024

What is the motivation for this change? My personal preference currently is to stay with printf unless there's a good reason to move.

src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
src/quicreach.cpp Fixed Show fixed Hide fixed
@Astabol
Copy link
Author

Astabol commented Dec 30, 2024

What is the motivation for this change? My personal preference currently is to stay with printf unless there's a good reason to move.

Instead of having C++ project I saw most of the component is used here is from C. So, I am working on the migration of this project completely to C++

That is the reason I thought of doing the migration step by step. And I choose printf first.

Using Namespace std removed; & Currently working on migrating of one of the function.

Most Importly std::cout is having type safety. So, I think its convanient to use it over printf.

Thank You

@Astabol Astabol changed the title Migrated from printf to std::cout Migrated from printf to std::cout && Removal of Using Namespace std; Dec 30, 2024
src/quicreach.cpp Outdated Show resolved Hide resolved
@Astabol Astabol closed this Dec 30, 2024
@Astabol Astabol reopened this Dec 30, 2024
@Astabol
Copy link
Author

Astabol commented Dec 30, 2024

I don't know how the pull request got closed. I was trying "new merge experience".

Anyway I reopened it.

@@ -25,8 +27,6 @@
#define QUIC_CALL
#endif

using namespace std;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer the using namespace model, as it makes all the code below less verbose. Why remove it?

AddrStr.Address,
HandshakeTags);
std::unique_lock<std::mutex> lock(Results.Mutex);
std::cout << std::setw(30) << HostName << " "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this conversion from printf to cout really makes it harder to read and understand what is being printed out.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @nibanks, It will be printed Hostname taking 30 char padding.

@nibanks
Copy link
Member

nibanks commented Dec 31, 2024

I appreciate the contribution. Thank you! For this particular change, though, I feel it makes the code harder to read. I am reaching out on our Discord server (for MsQuic) to get more community feedback before I make any final decision.

@Astabol
Copy link
Author

Astabol commented Dec 31, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants