Hacker Newsnew | past | comments | ask | show | jobs | submit | rantouan's commentslogin

overflow problems, which I try to avoid, start only if its bigger than int.

So I had assumed that in my case I'm alright. Do you see any change needed that I can't see ?

---

Maybe a good idea would had been to go by platform or architecture and use some macros to do the check only if it's really needed. What do you think of it ? How would you implement it ?

You can make a pull request as well.


If strtol reliably sets errno to ERANGE, you're fine (you'll get a compiler warning for "if (aLong < INT_MIN || aLong > INT_MAX) {" though, because it can never be true.)

I have no idea what the cross-platform reliability of strtol() is, regarding errno. Should be fine, I hope.


not bad, check my suggestion for pull request, above


For the restoring part, could you make a pull request please ? Open source strength is that we work together on things.


hello, errno is set to 0 first thing.

I added now a "/** * * */" separator to make it even more clear.

I don't know, but I like separating things like that, I think it's handy for cases like now that setting the errno was kind of mixed with vars initialization.

```

    errno = 0;

    char *strtolEndptr;
    ...

```

->

```

    errno = 0;

    /*** * * ***/

    char *strtolEndptr;
    ...
```


https://www.gnu.org/savannah-checkouts/gnu/libc/index.html : The project website can be found here: https://sourceware.org/glibc

->

https://sourceware.org/ Links table on the left -> "GLIBC" button

->

https://sourceware.org/glibc/ Top menu -> "sources"

->

https://sourceware.org/glibc/sources.html "gitweb" link

->

https://sourceware.org/git/?p=glibc.git Top menu -> "tree" link

->

https://sourceware.org/git/?p=glibc.git;a=tree Tree -> "stdlib" link

->

https://sourceware.org/git/?p=glibc.git;a=tree;f=stdlib;h=93... Tree -> "atoi.c" row -> "raw" link

->

https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=stdli...

``` /* Convert a string to an int. / int atoi (const char nptr) { return (int) strtol (nptr, (char *) NULL, 10); } libc_hidden_def (atoi) ```


very good !


voting up because I don't care if the API may be down, it's the idea that matters and the idea is good ! Keep working on it


Badgermole is a library for creating an SSH App server for OTP (One-Time Passwords) for authenticating requests to HTTP server. This library exists because usernames and passwords are unsafe in this day and age, while other OTP mechanics have become complicated.


While coding tends to be rigid, software engineering strives to be flexible. This flexibility is crucial because software engineering acts as the intermediary layer between code and the dynamic real world. In the real world, adaptability is key, and flexible software is more likely to align with the ever-changing demands, unlike rigid counterparts that may quickly become outdated.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: