日期:2014-05-16  浏览次数:21585 次

错误提示invalid operands to binary
#include<stdio.h>
#include<stdlib.h>
#include<signal.h>
int main()
{
  sigset_t set;
  int mask;
  if(sigfillset(&set)<0)
  {
  perror("sigfillset error");
  exit(1);
  }
  mask=1<<(SIGUSR1-1);
  printf("before clear\n");
  if(set&mask)
  printf("has been set\n");
  else
  printf("not been set\n");
  printf("\n\nafter clear\n");
  if(sigemptyset(&set)<0)
  {
  perror("sigemptyset error");
  exit(1);
  }
  if(set & mask)
  printf("has been set\n");
  else
  printf("not been set\n");
  exit(0);
}
编译提示错误:
sigemptyset.c: In function `main':
sigemptyset.c:15: error: invalid operands to binary &
sigemptyset.c:25: error: invalid operands to binary &
请问各位这是怎么回事?谢谢

------解决方案--------------------
毕竟sigset_t是个结构体,你并不清楚那个long数组意味着什么,比如它是作为一个bitset还只是作为long数组而已?