Re: [PATCH 1/2] parse-options: add int value pointer to struct option

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

 



On Mon, Sep 18, 2023 at 11:53:19AM +0200, René Scharfe wrote:
Am 11.09.23 um 21:19 schrieb Junio C Hamano:
Yup, that does cross my mind, even though I would have used

	union {
		void *void_ptr;
		int *int_ptr;
	} value;

or something without a rather meaningless 'u'.

OK, but I neglected to ask what we would get out of throwing different
types into the same bin.

It complicates type safety by making it impossible for the parser to distinguish the used type. [...]

this is somewhat ironic, given that using a union has some semantic value by illustrating that the fields are mutually exclusive. but i'm not sure that the checking is really important here, given that the initializers are inside centralized macros anyway.

regards



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux