Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Update bubble_sort.h#153

Open
Pranay711 wants to merge 1 commit intoxtaci:masterxtaci/algorithms:masterfrom
Pranay711:patch-2Pranay711/algorithms:patch-2Copy head branch name to clipboard
Open

Update bubble_sort.h#153
Pranay711 wants to merge 1 commit intoxtaci:masterxtaci/algorithms:masterfrom
Pranay711:patch-2Pranay711/algorithms:patch-2Copy head branch name to clipboard

Conversation

@Pranay711
Copy link

Bubble sort using template and funtion in c++. @pierredavidbelanger @Samana @blackball @wycg1984

@pierredavidbelanger
Copy link
Contributor

Since I am tagged, I will say something.

I am not sure its a good idea to include bits/stdc++, I was told a couple of time that this is not a good practice.
And anyways, using clang++ (the default for this project), it does not compile out of the box:

$ make bubble_sort_demo 
clang++ -g -Wall -Wno-unused-function -o bubble_sort_demo src/bubble_sort_demo.cpp -I./include -I. -lm
In file included from src/bubble_sort_demo.cpp:6:
./include/bubble_sort.h:26:10: fatal error: 'bits/stdc++' file not found
#include <bits/stdc++>
         ^~~~~~~~~~~~~
1 error generated.
make: *** [Makefile:245: bubble_sort_demo] Error 1

Also, src/bubble_sort_demo.cpp will expect the right namespace and function signature here

Do you care to explain what you are trying to achieve ?

Have a nice day :)

@pierredavidbelanger
Copy link
Contributor

From my point of view, it is not an improvement to

  • break public contract (the signature changed from alg::BubbleSort(T[], int, int) to std::bubble(X*, int))
  • include unknown header so the project does not compile (fatal error: 'bits/stdc++' file not found).

I feel I am missing something here, I will leave let others review this PR.

@Pranay711
Copy link
Author

Pranay711 commented Oct 1, 2020 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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.