This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [MI non-stop 04/11] Implement --thread and --frame.


> > 
> > sizeof? For all I know, sizeof("--thread") will be wrong here.
> 
> Why would it be wrong?

sizeof("--thread") seems to count the \0, so you need to do subtract 1.
Another danger is that if someone decides to convert from sizeof("--thread")
to something like:
  char* str="--thread";
  int len=sizeof(str); 

you are going to the size of a char* (4) inste of the string.
I think strlen() is better.

Marc


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]