Skip to content

C Code Fixes.#3235

Open
InfiniteCoder wants to merge 2 commits intoOpenGenus:masterfrom
InfiniteCoder:c_fixes
Open

C Code Fixes.#3235
InfiniteCoder wants to merge 2 commits intoOpenGenus:masterfrom
InfiniteCoder:c_fixes

Conversation

@InfiniteCoder
Copy link
Contributor

Fixes issue:

Some code fixes in C programs

Changes:

Fixed errors and warning in some programs. Deleted a program which was plagiarised.

abdouskamel
abdouskamel previously approved these changes Jan 31, 2018
Copy link
Contributor

@abdouskamel abdouskamel left a comment

Choose a reason for hiding this comment

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

Good job !

arnavb
arnavb previously approved these changes Feb 1, 2018
@AdiChat
Copy link
Member

AdiChat commented Feb 1, 2018

It is not encouraged to delete files.
You may modify the source code or add a comment regarding the source (on consulting the concerned contributor) as we encourage distributing credit.

Kindly make the changes and it will be good to be merged 👍

@InfiniteCoder
Copy link
Contributor Author

@AdiChat The problem is that the original author has not mentioned any licence, so by default we may consider it as copyright protected.

As Jeff Atwood says,

Without a license, the code is copyrighted by default. People can read the code, but they have no legal right to use it.

So this program would be incompatible with the license of cosmos, GNU GPLv3. So I'd rather delete a few plagiarised codes than using other people's code illegally.

int i;
pNode->value = 0;

Copy link

Choose a reason for hiding this comment

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

Is whitespace on blank lines like this actually wanted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@polyzen I don't know what the standards are in such cases, but my editor(Kate) adds whitespaces in blank lines when aligning the code. I couldn't find anything about it on the Internet.

Copy link

Choose a reason for hiding this comment

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

It's subjective, not objective, but trailing whitespace is more often frowned upon than not. Even more frowned upon when a patch clobbers history of lines like this for no reason other than whitespace changes.

bool isPresent(struct Node *head, int data);

bool
isPresent(struct Node *head, int data);
Copy link

Choose a reason for hiding this comment

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

I'm not convinced that putting types on separate lines like this in function prototypes is normal. I have mostly seen prototypes as single lines, with function definitions having the type on the line above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! fixed!

free(p); \
p = NULL;

Copy link

Choose a reason for hiding this comment

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

The indentation here was probably intentional, since the statements are part of the FREE macro. I don't see what removing the indent adds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for noting that. I'll fix it.

@abdouskamel
Copy link
Contributor

@AdiChat The removed code is just a copy-paste of the original, without any credit. I think that even though there were credits, it's not a good practice to provide a copy-paste of a third person code. We can take inspiration from a code found in the Internet, and mention the author, but copy and paste it gives a bad image.

@AdiChat AdiChat dismissed stale reviews from arnavb and abdouskamel via 3010cb5 September 30, 2021 20:41
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.

6 participants

Comments