Cでは、どのようにnタプルを作成して使用しようとすると、最後の要素しか使用できません。タイプでさえ、明らかにタプルの最後の要素であり、タプル自体ではありません。最後の要素以外の要素を取得するにはどうすればよいですか?スペックをすばやく調べたところ、何もわかりませんでした。
例:
#include <stdio.h>
int f() {return 2;}
char* g() {return "dudebro";}
int main() {
printf("%d\n", (f(),g(),3)); /* Should print the address of the tuple (unless it's by-value, in which case it should be a compile error) but prints the last element?*/
return 0;
}
それを実行します:
$ gcc -ansi -pedantic -Wall -Wextra tt.c -o tt
$ ./tt
3