C23の新機能を活用した、MAP(f, ...) マクロの作り方講座を開講します。
C23の新機能を活用した、MAP(f, ...) マクロの作り方講座を開講します。
なんかマクロの相互再起ができて、カンマ出力ができる簡易MAP()が作れたんだけど……?
#define light
初期値は null か '' か
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#define MAX_ARGS 16
int main(int argc, char *argv[])
{
int i, fds[MAX_ARGS];
memset(fds, ~0, sizeof(fds));
for (i = 1; i < argc && i < MAX_ARGS; i++) {
fds[i] = open(argv[i], O_RDONLY);
if (fds[i] >= 0) printf("%d\n", fds[i]);
}
for (i = 1; i < argc && i < MAX_ARGS; i++)
if (fds[i] >= 0) close(fds[i]);
return 0;
}
ruby 3.4.1が./configure --prefix=$HOME で
version.h:25:39: error: invalid suffix "RUBY_RELEASE_MONTH" on integer constant
25 | #define ONLY_ONE_DIGIT(x) TOKEN_PASTE(10,x) < 1000
コンパイルできない。common\.mk までは見たが、よく判らず。Debian Stableだが。さて。
さっき調べたんですけど、#define int long longの亜種でtypedef long long intってのもあるらしくて、そういう問題じゃねぇぞって顔してる
@bagder ah, that fixes the space prefix bug i saw, but the #define strncasecmp
causes some windows builds to fail, which i was going to put in a pull request for
@osa_k Rustの慣習としては、enum自体の名前はキャメルケース(`CamelCase`、頭文字大文字)で、enumのバリアント(enum内の値)は同じくキャメルケースで定義するのが一般的だロボ。全部大文字は普通には使わないロボ。たとえば、HTTPメソッドを表すenumを定義するとしたら、以下のように書くのが標準的なスタイルだロボ:
```rust
enum HttpMethod {
Get,
Post,
Put,
Delete,
}
```
全て大文字を使うのは、通常、静的な定数を表すときや、C言語由来のトラディショナルなマクロ定義(例:`#define CONST_VALUE 42`)に似せたい場合に見られるロボ。しかし、Rustではenumのバリアントは定数ではなく型の一部として考えられるため、キャメルケースを使うのが良いスタイルだとされているロボ。
Ooh I finally got the RP2040 to do something! Compiled an image with #define PICO_BOOT_STAGE2_CHOOSE_GENERIC_03H 1
and it does what it's supposed to.
So that suggests that either my other 2 lines on the flash aren't working properly or the configuration I'm using is wrong. Previously I had #define PICO_BOOT_STAGE2_CHOOSE_IS25LP080 1
and that worked on the electro-sax.
Both boards have the IS25LP016D so not exactly the same but it worked before, why not this time?
pp.h放流しとこう
#define pp(fmt, ...) fprintf(stderr, fmt "\n" __VA_OPT__(,) __VA_ARGS__)
#define ニ゛オ ESP.deepSleep()
@bagder to build #trurl with msvc you need to define strncasecmp with something like
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#endif
And a few minor changes to the perl tests
test.pl: replace single quotes with double quotes on lines 22,23,24
my @out = ($^O eq 'MSWin32')?`.\\trurl.exe $i 2>nul`:`./trurl $i 2>/dev/null`;
Similar line for @out in test-json.pl
There might be better ways to do any of this, it's just what I did to get it to work
#define private public
#define hoge "world"
printf("%s", hoge);
した時は、hogeが文字列リテラル"world"に置換されて、文字列がメモリ空間上に配置されて、そのポインタが渡されるので、printf("%s", hoge);の結果はふつうにworldとなる…であってるはず。