Skip to content
Tcl Source Code View Ticket
Login

View Ticket

SGI warning: tclUnixTest.c

Closed / Fixed664755ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 23 years ago
Descriptionplain2003-01-08 23:36:38
cc-1183 cc: WARNING File = ./../unix/tclUnixTest.c,
Line = 650
  An unsigned integer is being compared to zero.

      if (alarm(sec) < 0) {
                     ^
vincentdarleyplain2003-01-09 17:05:50
Logged In: YES 
user_id=32170

Not sure what category this belongs in, but surely not the
filesystem. I frankly have no idea about this code, and on
top of that it's unix-specific...
dgpplain2003-01-09 22:52:53
Logged In: YES 
user_id=80530

testalarm command appears to be used
only in tests/unixFCmd.test which is
part of the FIle System Category.
dgp Ticket [664755ffff]: 1 change [History diff]2003-10-03 05:14:21
jenglishplain2003-10-12 01:38:01
Logged In: YES 
user_id=68433

Full context:
    if (alarm(sec) < 0) {
        Tcl_AppendResult(interp, "alarm: ",
Tcl_PosixError(interp), NULL);
        return TCL_ERROR;
    }

However, according to alarm(2):

unsigned int alarm(unsigned int seconds);
...
RETURN VALUE
       alarm returns the number of  seconds  remaining 
until  any previously scheduled alarm was due to be
delivered, or zero if there was no previously scheduled alarm.

IOW, there are no error conditions; alarm() always succeeds.
 (manpages on HP-UX, AIX, IRIX, and Linux all say something
similar.  Also, this interface goes all the way back to SVID2).

It should be safe to just say:

     (void)alarm(sec);

instead.
hobbsplain2003-10-13 06:26:47
Logged In: YES 
user_id=72656

corrected as noted by english for 8.4.5 and 8.5a0
hobbs Ticket [664755ffff]: 2 changes [History diff]2003-10-13 06:26:48
Log in (anonymous is fine) to add a comment.