[openib-general] [PATCH] mad: Add port number to MAD thread names

Johannes Erdfelt johannes at erdfelt.com
Thu Nov 18 11:18:31 PST 2004


On Thu, Nov 18, 2004, Roland Dreier <roland at topspin.com> wrote:
>     Johannes> You mean
> 
>     Johannes> 	char name[sizeof "ib_mad123" + 1];
> 
>     Johannes> right? :)
> 
> No, actually sizeof a string includes the trailing nul.  Try the
> following program:
> 
>     int main() { printf("%d\n", (int) sizeof "123"); }
> 
> I bet it prints "4" :)

You know, I knew that at one point, but I guess I forgot it for some
reason because you're absolutely right.

I guess I was thinking strlen instead of sizeof.

JE




More information about the general mailing list