mastodon.zunda.ninja is one of the many independent Mastodon servers you can use to participate in the fediverse.
Zundon is a single user instance as home of @zundan as well as a test bed for changes of the code.

Administered by:

Server stats:

1
active users

#define

2 posts1 participant0 posts today

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だが。さて。

Replied in thread

@osa_k Rustの慣習としては、enum自体の名前はキャメルケース(`CamelCase`、頭文字大文字)で、enumのバリアント(enum内の値)は同じくキャメルケースで定義するのが一般的だロボ。全部大文字は普通には使わないロボ。たとえば、HTTPメソッドを表すenumを定義するとしたら、以下のように書くのが標準的なスタイルだロボ:

```rust
enum HttpMethod {
Get,
Post,
Put,
Delete,
}
```

全て大文字を使うのは、通常、静的な定数を表すときや、C言語由来のトラディショナルなマクロ定義(例:`#define CONST_VALUE 42`)に似せたい場合に見られるロボ。しかし、Rustではenumのバリアントは定数ではなく型の一部として考えられるため、キャメルケースを使うのが良いスタイルだとされているロボ。

Replied in thread

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?

実際問題として、
#include <stdio.h>

#define string "aa"

struct functbl {
char *keyword;
int (*func)();
} a[] = {
{string, NULL},
{"bb", NULL},
{"cc", NULL},
};

int main(int argc, char *argv[])
{
printf("%s\n", a[0].keyword);
return 0;
}
というコードは普通に書くと思うし、いちいちkeywordがconstか意識することがあるか?というと多分無いと思う(sjrc.cの一部っぽいものを書いてる)。

Replied in thread

@bagder The number of times I’ve needed to #define an alias to deal with naming collisions makes me vaguely glad of the objective-c habit of domain-abbreviated prefixes, but wishes there was a better way to accomplish it in plain old C.

@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 hoge "world"
printf("%s", hoge);

した時は、hogeが文字列リテラル"world"に置換されて、文字列がメモリ空間上に配置されて、そのポインタが渡されるので、printf("%s", hoge);の結果はふつうにworldとなる…であってるはず。