Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-04 Thread SF Markus Elfring
>>> You could define an xprintf() macro that checks if the return value >>> is < 0 and simply calls perror() and exit(1) in such case. >> Does such a macro belong to any general header file from the Linux >> software library? > No. Would you like to add it? How do you think about to reuse it in m

Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-04 Thread Michal Marek
On 2016-11-03 20:48, SF Markus Elfring wrote: >> You could define an xprintf() macro that checks if the return value >> is < 0 and simply calls perror() and exit(1) in such case. > > Does such a macro belong to any general header file from the Linux > software library? No. Michal

Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-03 Thread SF Markus Elfring
> You could define an xprintf() macro that checks if the return value > is < 0 and simply calls perror() and exit(1) in such case. Does such a macro belong to any general header file from the Linux software library? Regards, Markus

Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-03 Thread Michal Marek
Dne 2.11.2016 v 19:46 SF Markus Elfring napsal(a): >> I like the code as is. > > Do you really prefer to ignore important return values in the discussed > function? You could define an xprintf() macro that checks if the return value is < 0 and simply calls perror() and exit(1) in such case. Mic

Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-02 Thread SF Markus Elfring
> I like the code as is. Do you really prefer to ignore important return values in the discussed function? > Such error checks and magic numbers are messy. Is it safer to detect exceptional situations as early as possible here? Regards, Markus

Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-02 Thread Masahiro Yamada
2016-11-03 2:48 GMT+09:00 SF Markus Elfring : >> Is replacing printf("\"\n") with puts("\"") optimization? > > Is the difference relevant if an “ordinary” string is passed instead of > a format string? I think GCC does the replacement automatically unless -ffreestanding option is given. With a q

Re: scripts/basic/bin2c: Complete error handling in main()

2016-11-02 Thread SF Markus Elfring
> Is replacing printf("\"\n") with puts("\"") optimization? Is the difference relevant if an “ordinary” string is passed instead of a format string? > Frankly, the result of this patch seems extremely unreadable code. Do you care for more complete error detection and corresponding exception ha