Skip to main content

Timeline for Simple hashing algorithm

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Feb 12, 2020 at 15:13 history edited Toby Speight CC BY-SA 4.0
strlen() returns a size_t
Feb 12, 2020 at 15:10 comment added Toby Speight @chux, I realised that just after I went to bed; forgot to come back and fix it. Thanks for prodding me!
Feb 12, 2020 at 15:05 comment added chux Minor: "This is exactly what strlen() (in <string.h>) is for: int const inputLen = strlen(input);" --> except strlen() returns size_t. OP's code should be adjusted for that.
Feb 12, 2020 at 9:33 history edited Toby Speight CC BY-SA 4.0
Serious bug
Feb 12, 2020 at 9:07 history edited Toby Speight CC BY-SA 4.0
added 1086 characters in body
Feb 12, 2020 at 7:20 comment added Toby Speight Yes, <string.h> is part of the Standard Library, and therefore supplied as part of your compiler. That means that it's provided as part of your development platform, and implementations do indeed vary. In particular, compilers are allowed to recognise Standard Library functions and handle them specially - for instance, see the Stack Overflow question, Can printf get replaced by puts automatically in a C program?
Feb 12, 2020 at 7:15 history edited Toby Speight CC BY-SA 4.0
added 259 characters in body
Feb 11, 2020 at 23:43 comment added thzoid But doesn't memset() belong to <string.h>? Do these libraries vary from compiler to compiler? I thought they were components of the language itself.
Feb 11, 2020 at 23:39 comment added Toby Speight You don't reimplement memset() - trust your compiler to have much better knowledge of the target architecture than we C programmers ever can. Each compiler can provide an implementation carefully targeted at its platform; portable code will not (and should not) do that.
Feb 11, 2020 at 23:37 history edited Toby Speight CC BY-SA 4.0
added 318 characters in body
Feb 11, 2020 at 23:36 comment added thzoid I read somewhere that casting malloc()s to pointer types was a good practice, I'm not sure why, though. Thanks a lot for the helpful review. Just one question: why did you say I was reimplementing memset() less efficiently? How'd you reimplement it in a better way?
Feb 11, 2020 at 23:27 history edited Toby Speight CC BY-SA 4.0
added 187 characters in body; added 4 characters in body
Feb 11, 2020 at 23:19 history answered Toby Speight CC BY-SA 4.0