| | |
Problem in sorting by name
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
>You tell that to my colleague who happen to see me swiftly write the code and who checked it.
I don't care how fast you wrote it. I'd rather have good code that someone took time to check, rather than to read quickly-written code that sucks ass.
>As I specified earlier, as you seemed to have ignored, it did compile sucessfully.
I don't know HOW those errors that I stated previously would compile on anything. And if it really did, the compiler deserves to be thrown out the window, because compiler errors are supposed to alert you to mistakes in your code (at least the ones the compiler can see).
>You should be more considerate when make such absolute claims.
Those errors were pretty absolute to me, and I'm sure you cannot deny the mistakes I already pointed out.
I don't care how fast you wrote it. I'd rather have good code that someone took time to check, rather than to read quickly-written code that sucks ass.
>As I specified earlier, as you seemed to have ignored, it did compile sucessfully.
I don't know HOW those errors that I stated previously would compile on anything. And if it really did, the compiler deserves to be thrown out the window, because compiler errors are supposed to alert you to mistakes in your code (at least the ones the compiler can see).
>You should be more considerate when make such absolute claims.
Those errors were pretty absolute to me, and I'm sure you cannot deny the mistakes I already pointed out.
"Technological progress is like an axe in the hands of a pathological criminal."
All my posts may be freely redistributed under the terms of the MIT license.
All my posts may be freely redistributed under the terms of the MIT license.
> Well if he is learning then he is a beginner. So what is your point?
So we have to make sure they doesn't pick up wrong programming practices.
All this time you seem to be ignoring, my and Joe's constructive criticism. This is not the way things are done. A working code is not the same as a concise, clear and helpful code. You have to understand that the code which you post in the code snippets section is used and referred by thousands of beginners everyday. A high standard has to be maintained.
Picking at people who have been here for a long time is no solution to the problem. Try to improve yourself.
So we have to make sure they doesn't pick up wrong programming practices.
All this time you seem to be ignoring, my and Joe's constructive criticism. This is not the way things are done. A working code is not the same as a concise, clear and helpful code. You have to understand that the code which you post in the code snippets section is used and referred by thousands of beginners everyday. A high standard has to be maintained.
Picking at people who have been here for a long time is no solution to the problem. Try to improve yourself.
I don't accept change; I don't deserve to live.
•
•
•
•
Lazaro, make sure your code is up to the specified standards like Joey said. I see a lot of beginner style programming which may confuse other people trying to learn the language.
•
•
•
•
c Syntax (Toggle Plain Text)
for (i=0;i<len1 && i<len2;i++) { if (str1[i] < str2[i]) return 1; else if (str[i] > str2[i]) return 2; } return 0 ; }
It should be something like: (not the exact implementation)
c Syntax (Toggle Plain Text)
{ for (i=0;i<len1 && i<len2;i++) { if (str1[i] < str2[i]) return str1 [i] - str2 [i] ; else if (str[i] > str2[i]) return str1 [i] - str2 [i]; /* Forgot the semi-colon */ } return 0 ; }
though I would even modify the loop to make it better, but then again, its okay.
This is not how string comparision function works. The string comparision functions returns the ASCII difference between the strings if they are unequal while a zero if they are equal.
Ok, it does not exactly work like that, however, please inform me on how returning 1, 2..... is newbie code? Why because I don't subtract them? Lol, ok. Wow what an advanced technique.
Half baked, it works doesn't it? And because I don't subtract the difference, doesn't render the function half baked. That is absurd.
Last edited by Lazaro Claiborn; Mar 12th, 2007 at 11:33 pm.
> I'd really appreciate a link to a standard specification either for C (?) or for Daniweb, seriously.
It comes from practice. Just look around and read the code snippets and posts contributed by experienced people and you would know.
> Ok, it does not exactly work like that, however, please inform me on how returning 1, 2..... is
> newbie code? Why because I don't subtract them?
As for your implementation, read the actual specification of the strcmp function. Making your own functions which performs in a different way only adds to the confusion.
It comes from practice. Just look around and read the code snippets and posts contributed by experienced people and you would know.
> Ok, it does not exactly work like that, however, please inform me on how returning 1, 2..... is
> newbie code? Why because I don't subtract them?
As for your implementation, read the actual specification of the strcmp function. Making your own functions which performs in a different way only adds to the confusion.
Last edited by ~s.o.s~; Mar 12th, 2007 at 11:38 pm.
I don't accept change; I don't deserve to live.
Wow you've obviously got superior reasoning....:lol: Anyway, I guess I'll starting paying attention to such menial considerations. Regarding the programming suggestions I mean. Lol.
Last edited by Lazaro Claiborn; Mar 12th, 2007 at 11:43 pm.
•
•
•
•
Yeah.... well it is a good thing it is your opinion. :lol:
if ((str[i] >= 'a' && str[i] <= 'z'))is extremely more readable than
if ((str[i] >= 65 && str[i] <= 90))And it will even work for code on EBCDIC machines... :p
I'd like to hear any dissenting opinion that is sensible...
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
•
•
•
•
Here is another example program that might help you:
http://www.daniweb.com/code/snippet661.html
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Sorting and Searching to get rid of Duplicate Numbers (C++)
- Need Urgent Help in Sorting (Shell Scripting)
- Problem of sorting words of each string using pointers (C++)
- Need Help with ArrayList sorting (Java)
Other Threads in the C Forum
- Previous Thread: threading
- Next Thread: Operation on Binary number, Need source code for elementar operation (+-*/)
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv fgets file floatingpointvalidation fork framework function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include infiniteloop initialization input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux list lists looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation overwrite owf pdf pointer pointers posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprogramming standard strchr string suggestions systemcall test testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi






