[Qt-interest] Returning arbitrary value with QApplication::exit()

Diego Schulz dschulz at gmail.com
Fri Jun 26 21:13:11 CEST 2009


On Fri, Jun 26, 2009 at 1:47 PM, Pascal Patry<iscy at invalidip.com> wrote:
>
> yes, it is correct and you can safely use it...
>
>> Is there something I should be aware if I want to do this?
>
> yes, on some platforms (at least on unix) the exit code will get into a
> logical 'and'. the returned value will be 'status' & 0377. So the exit codes
> are possible between 0 and 255 inclusively. If you strictly use your constant
> inside your own application, you don't have to bother with this.
>

Thank you Pascal.


On Fri, Jun 26, 2009 at 2:13 PM, John McClurkin<jwm at nei.nih.gov> wrote:
>
> One thing to consider. The first argument to QApplication is a reference
> to argc, not a copy. Therefore, if QApplication changes argc, it will be
> changed in main. Looking at the source code, there is one place where it
> could be changed. Therefore, I would make local copies of argc and argv
> and initialize them inside the do-while loop and then pass these copies
>  when creating a QApplication object.
>

Good point, John. I wasn't aware of that. Thank you.



More information about the Qt-interest-old mailing list