Sujet : Re: When Is A High/Low-Level Language Not A High/Low-Level Language?
De : sgk (at) *nospam* REMOVEtroutmask.apl.washington.edu (Steven G. Kargl)
Groupes : comp.lang.cDate : 17. Aug 2024, 03:40:23
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v9p2in$1ot42$1@dont-email.me>
References : 1
User-Agent : Pan/0.145 (Duplicitous mercenary valetism; d7e168a git.gnome.org/pan2)
On Fri, 16 Aug 2024 05:58:10 +0000, Lawrence D'Oliveiro wrote:
Here’s a little bit of Python code, from <https://gitlab.com/ldo/inotipy>:
info_type = infoptr.contents.info_type
infoptr = ct.cast \
(
infoptr,
ct.POINTER
(
{
FANOTIFY.EVENT_INFO_TYPE_FID : FANOTIFY.event_info_fid,
FANOTIFY.EVENT_INFO_TYPE_DFID_NAME : FANOTIFY.event_info_fid,
FANOTIFY.EVENT_INFO_TYPE_DFID : FANOTIFY.event_info_fid,
FANOTIFY.EVENT_INFO_TYPE_PIDFD : FANOTIFY.event_info_pidfd,
FANOTIFY.EVENT_INFO_TYPE_ERROR : FANOTIFY.event_info_error,
}[info_type]
)
)
That’s a conditional cast, based on a common header field, to the
appropriate struct type for that data block.
That’s not just a switch-expression, it’s a switch-expression
returning a type.
Who cares? So what? What does this have to do with C?
-- steve