[sr-dev] how to define an infinite while loop?
Andrei Pelinescu-Onciul
andrei at iptel.org
Fri Apr 2 10:53:16 CEST 2010
On Apr 01, 2010 at 22:23, Ovidiu Sas <osas at voipembedded.com> wrote:
> If I define an infinite loop like this:
> while( true ) {
> ...
> }
> the following warning is reported:
> WARNING: <core> [cfg.y:3307]: warning in config file
> /etc/kamailio/kamailio.cfg, line 4, column 9-12: constant value in
> while(...)
> The config file used for testing:
> #!KAMAILIO
>
> route{
> while( true ) {
> exit;
> }
> exit;
> }
>
>
> How can I define a simple infinite loop without getting a warning in the logs.
>
> I don't want to define a variable just for the while loop and test it.
> $var(true) = 1;
> while ($var(true)) {
> ...
> }
>
> Is there a specific PV like '$null' or a specific keyword?
No, you have to live with the warning.
In most cases infinite loops are a bug and hence we better have the
warning (this is a sip router and not a general programing language).
Andrei
More information about the sr-dev
mailing list