bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sig2str and str2sig use in C++


From: Paul Eggert
Subject: Re: sig2str and str2sig use in C++
Date: Mon, 10 Jun 2013 15:47:20 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6

On 06/05/13 09:57, Daniel J Sebald wrote:
> 
> 
> Well, taking this all into consideration, perhaps the easiest thing to do is 
> construct a table at runtime on the heap:

I'd rather avoid the runtime overhead.

How about something like this?

enum { HUP_OFFSET = 0 };
#define HUP_STRING "string for SIGHUP"

enum { INT_OFFSET = HUP_OFFSET + sizeof HUP_STRING };
#define INT_STRING "string for SIGINT"

enum { QUIT_OFFSET = INT_OFFSET + sizeof INT_STRING };
#define QUIT_STRING "string for SIGQUIT"

A bit awkward, but no repeated strings; and I've seen worse.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]