#define — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #define, aggregated by home.social.
-
防御型空母
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。https://note.com/poison_raika/n/nd8be14f2aa74
<>
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
<built-in>:40:32: error: source file is not valid UTF-8
40 | #define __VERSION__ "Clang 21.1.1"
| ^thanks clang ??
-
Okay, macro approach blows everything else out of the water, catching all narrowing conversions at the type level. I don't think I can use it for the `mke_u16` (make, but report errors) variant without getting a little clever/hybrid about it, but the hybrid approach actually does work.
```
typedef int err_t; // For snippetware purposes// Secret inner thing with underscore
static inline err_t _mke_u16(u16 *dest, u16 src) {
*dest = src;
return 0;
}// Actual API
#define mke_u16(dest, v) _mke_u16(dest, u16{v})int main() {
err_t err;
u16 dest;
err = mke_u16(&dest, 5); // Correct, works
err = mke_u16(&dest, -4); // Incorrect, caught
err = mke_u16(&dest, 0xFFFF1); // Incorrect, caughtuint16_t srcA = 0xFFFF;
err = mke_u16(&dest, srcA); // Correct, worksuint32_t srcB = 0x1; // Fine value, bad type
err = mke_u16(&dest, srcB); // Incorrect, caught
return err;
}
```This, of course, raises the question what an API consumer would use `mke_u16` *for*.
-
The Quiet Engineering Move That Could Define How a Cape Canaveral Air-Launch Operator Gets to Flight
https://atlas.whatip.xyz/post.php?slug=the-quiet-engineering-move-that-could-define-how-a-cape-canaveral-air-launch-operator-gets-to-flight
Quick take: <p>Issued on behalf of Starfighters Space, Inc
#starfighters #engineering #flight #define -
The Quiet Engineering Move That Could Define How a Cape Canaveral Air-Launch Operator Gets to Flight
https://atlas.whatip.xyz/post.php?slug=the-quiet-engineering-move-that-could-define-how-a-cape-canaveral-air-launch-operator-gets-to-flight
Quick take: <p>Issued on behalf of Starfighters Space, Inc
#starfighters #engineering #flight #define -
RE: https://social.vivaldi.net/@lproven/116606640904248333
isso aqui me pegou
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
#define DO ){
#define OD ;}
#define REP do_lbr
#define PER }while(
#define DONE );
#define LOOP for(;;){
#define POOL } -
RE: https://social.vivaldi.net/@lproven/116606640904248333
isso aqui me pegou
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
#define DO ){
#define OD ;}
#define REP do_lbr
#define PER }while(
#define DONE );
#define LOOP for(;;){
#define POOL } -
RE: https://social.vivaldi.net/@lproven/116606640904248333
isso aqui me pegou
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
#define DO ){
#define OD ;}
#define REP do_lbr
#define PER }while(
#define DONE );
#define LOOP for(;;){
#define POOL } -
RE: https://social.vivaldi.net/@lproven/116606640904248333
isso aqui me pegou
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
#define DO ){
#define OD ;}
#define REP do_lbr
#define PER }while(
#define DONE );
#define LOOP for(;;){
#define POOL } -
RE: https://social.vivaldi.net/@lproven/116606640904248333
isso aqui me pegou
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
#define DO ){
#define OD ;}
#define REP do_lbr
#define PER }while(
#define DONE );
#define LOOP for(;;){
#define POOL } -
防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.https://www.pixiv.net/novel/show.php?id=20023587
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.https://www.pixiv.net/novel/show.php?id=20023587
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.https://www.pixiv.net/novel/show.php?id=20023587
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.https://www.pixiv.net/novel/show.php?id=20023587
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.https://www.pixiv.net/novel/show.php?id=20023587
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
防御型空母て何? What is a defensive aircraft carrier?
防御型空母。日本では空母保有を巡って、議論が、一応''なさられてる''一応。
Defensive aircraft carrier. In Japan, there is some discussion about having an aircraft carrier.https://www.pixiv.net/novel/show.php?id=20023587
#japan #reality #like #define #international #support #problem #attack #scope #distance #understand #aircraft #enemy #limit #introduce #various #carrier #proposal #rescue #counterattack #missions #restrictions #defensive #territorial
-
some punk 31 years ago was tired of dealing with "correctly matching const char* vs char*" so they just did
#define CONST
and now it's my problem
-
some punk 31 years ago was tired of dealing with "correctly matching const char* vs char*" so they just did
#define CONST
and now it's my problem
-
some punk 31 years ago was tired of dealing with "correctly matching const char* vs char*" so they just did
#define CONST
and now it's my problem
-
some punk 31 years ago was tired of dealing with "correctly matching const char* vs char*" so they just did
#define CONST
and now it's my problem
-
some punk 31 years ago was tired of dealing with "correctly matching const char* vs char*" so they just did
#define CONST
and now it's my problem
-
So the whole point of the current "regularization" initiative is, instead of optimizing the compressability of the source code, I'm optimizing for compressability of the *model in the programmer's head.*
I shouldn't need to remember all the time that I can make a short literal number as a compile-time constant with `PRN_ITEXT("3")`. I should be able to look in `mk.h` (the object construction header) and see:
```
// Regular versions must be 255 chars or less.
// Constant versions must be 7 chars or less.
/* ... */
#define PRN_MK_LITNUM(s) ...
```Oh cool! A way to make a compile-time constant number literal object without thinking about how it works, and I knew just where to look to refresh my memory! Spiffing!
This isn't to say that the programming model should hide these internal symmetries. I don't think that's healthy. The point is that you can see them when you need to, but ignore them the other 90% of the time. THAT's healthy.
-
So the whole point of the current "regularization" initiative is, instead of optimizing the compressability of the source code, I'm optimizing for compressability of the *model in the programmer's head.*
I shouldn't need to remember all the time that I can make a short literal number as a compile-time constant with `PRN_ITEXT("3")`. I should be able to look in `mk.h` (the object construction header) and see:
```
// Regular versions must be 255 chars or less.
// Constant versions must be 7 chars or less.
/* ... */
#define PRN_MK_LITNUM(s) ...
```Oh cool! A way to make a compile-time constant number literal object without thinking about how it works, and I knew just where to look to refresh my memory! Spiffing!
This isn't to say that the programming model should hide these internal symmetries. I don't think that's healthy. The point is that you can see them when you need to, but ignore them the other 90% of the time. THAT's healthy.
-
So the whole point of the current "regularization" initiative is, instead of optimizing the compressability of the source code, I'm optimizing for compressability of the *model in the programmer's head.*
I shouldn't need to remember all the time that I can make a short literal number as a compile-time constant with `PRN_ITEXT("3")`. I should be able to look in `mk.h` (the object construction header) and see:
```
// Regular versions must be 255 chars or less.
// Constant versions must be 7 chars or less.
/* ... */
#define PRN_MK_LITNUM(s) ...
```Oh cool! A way to make a compile-time constant number literal object without thinking about how it works, and I knew just where to look to refresh my memory! Spiffing!
This isn't to say that the programming model should hide these internal symmetries. I don't think that's healthy. The point is that you can see them when you need to, but ignore them the other 90% of the time. THAT's healthy.
-
So the whole point of the current "regularization" initiative is, instead of optimizing the compressability of the source code, I'm optimizing for compressability of the *model in the programmer's head.*
I shouldn't need to remember all the time that I can make a short literal number as a compile-time constant with `PRN_ITEXT("3")`. I should be able to look in `mk.h` (the object construction header) and see:
```
// Regular versions must be 255 chars or less.
// Constant versions must be 7 chars or less.
/* ... */
#define PRN_MK_LITNUM(s) ...
```Oh cool! A way to make a compile-time constant number literal object without thinking about how it works, and I knew just where to look to refresh my memory! Spiffing!
This isn't to say that the programming model should hide these internal symmetries. I don't think that's healthy. The point is that you can see them when you need to, but ignore them the other 90% of the time. THAT's healthy.
-
So the whole point of the current "regularization" initiative is, instead of optimizing the compressability of the source code, I'm optimizing for compressability of the *model in the programmer's head.*
I shouldn't need to remember all the time that I can make a short literal number as a compile-time constant with `PRN_ITEXT("3")`. I should be able to look in `mk.h` (the object construction header) and see:
```
// Regular versions must be 255 chars or less.
// Constant versions must be 7 chars or less.
/* ... */
#define PRN_MK_LITNUM(s) ...
```Oh cool! A way to make a compile-time constant number literal object without thinking about how it works, and I knew just where to look to refresh my memory! Spiffing!
This isn't to say that the programming model should hide these internal symmetries. I don't think that's healthy. The point is that you can see them when you need to, but ignore them the other 90% of the time. THAT's healthy.
-
Update: I've fully figured out the repeatable pattern I want to use for object construction functions in #pronelang. Each object has at least the following four regular functions. Assume that the `...` are always the same consistent args which are sensible for type foo.
```
// Attempt to make a foo and return an error value (an enum where 0 = OK).
err_t mke_foo(foo_t *dest, ...);// Run mke_foo, assert on the err_t, return the result.
foo_t mk_foo(...);// Return a DV of a new foo, or an error atom on failure.
dv_t mkde_foo(...);// Return a DV of a new foo. Asserts on error.
dv_t mkd_foo(...);// Optional: compile-time construction logic.
#define MKD_FOO(...) /* impl */
#define MK_FOO(...) /* impl */
```Unwrappy variants are given ergonomic priority since most callsites can be statically known (to human reviewers) to be infallible. I've implemented everything but the optional macros for atoms, and I'm using naive non-inline functions for now since I'm not in an optimization sprint.
-
Update: I've fully figured out the repeatable pattern I want to use for object construction functions in #pronelang. Each object has at least the following four regular functions. Assume that the `...` are always the same consistent args which are sensible for type foo.
```
// Attempt to make a foo and return an error value (an enum where 0 = OK).
err_t mke_foo(foo_t *dest, ...);// Run mke_foo, assert on the err_t, return the result.
foo_t mk_foo(...);// Return a DV of a new foo, or an error atom on failure.
dv_t mkde_foo(...);// Return a DV of a new foo. Asserts on error.
dv_t mkd_foo(...);// Optional: compile-time construction logic.
#define MKD_FOO(...) /* impl */
#define MK_FOO(...) /* impl */
```Unwrappy variants are given ergonomic priority since most callsites can be statically known (to human reviewers) to be infallible. I've implemented everything but the optional macros for atoms, and I'm using naive non-inline functions for now since I'm not in an optimization sprint.
-
Update: I've fully figured out the repeatable pattern I want to use for object construction functions in #pronelang. Each object has at least the following four regular functions. Assume that the `...` are always the same consistent args which are sensible for type foo.
```
// Attempt to make a foo and return an error value (an enum where 0 = OK).
err_t mke_foo(foo_t *dest, ...);// Run mke_foo, assert on the err_t, return the result.
foo_t mk_foo(...);// Return a DV of a new foo, or an error atom on failure.
dv_t mkde_foo(...);// Return a DV of a new foo. Asserts on error.
dv_t mkd_foo(...);// Optional: compile-time construction logic.
#define MKD_FOO(...) /* impl */
#define MK_FOO(...) /* impl */
```Unwrappy variants are given ergonomic priority since most callsites can be statically known (to human reviewers) to be infallible. I've implemented everything but the optional macros for atoms, and I'm using naive non-inline functions for now since I'm not in an optimization sprint.
-
Update: I've fully figured out the repeatable pattern I want to use for object construction functions in #pronelang. Each object has at least the following four regular functions. Assume that the `...` are always the same consistent args which are sensible for type foo.
```
// Attempt to make a foo and return an error value (an enum where 0 = OK).
err_t mke_foo(foo_t *dest, ...);// Run mke_foo, assert on the err_t, return the result.
foo_t mk_foo(...);// Return a DV of a new foo, or an error atom on failure.
dv_t mkde_foo(...);// Return a DV of a new foo. Asserts on error.
dv_t mkd_foo(...);// Optional: compile-time construction logic.
#define MKD_FOO(...) /* impl */
#define MK_FOO(...) /* impl */
```Unwrappy variants are given ergonomic priority since most callsites can be statically known (to human reviewers) to be infallible. I've implemented everything but the optional macros for atoms, and I'm using naive non-inline functions for now since I'm not in an optimization sprint.
-
@david_chisnall @FritzAdalis What about #include and #define ? I love those tags...
-
@david_chisnall @FritzAdalis What about #include and #define ? I love those tags...
-
@david_chisnall @FritzAdalis What about #include and #define ? I love those tags...
-
@david_chisnall @FritzAdalis What about #include and #define ? I love those tags...
-
@david_chisnall @FritzAdalis What about #include and #define ? I love those tags...
-
@ska I dunno, it's there on all my machines:
phendrana:~ eureka% cpp -dM /usr/include/errno.h | grep EREMOTEIO
#define EREMOTEIO 121@khm's explanation of a short read makes sense, but I don't see how that's possible in this environment. it's a qemu-kvm instance, the drive is virtio-blk-scsi backed by LVM with no IO errors on the host reported (or in qemu logs). nothing in the guest kernel logs either. I might understand it if the guest filesystem were damaged and it was a *read* but on a *write* ?
-
@ska I dunno, it's there on all my machines:
phendrana:~ eureka% cpp -dM /usr/include/errno.h | grep EREMOTEIO
#define EREMOTEIO 121@khm's explanation of a short read makes sense, but I don't see how that's possible in this environment. it's a qemu-kvm instance, the drive is virtio-blk-scsi backed by LVM with no IO errors on the host reported (or in qemu logs). nothing in the guest kernel logs either. I might understand it if the guest filesystem were damaged and it was a *read* but on a *write* ?
-
@ska I dunno, it's there on all my machines:
phendrana:~ eureka% cpp -dM /usr/include/errno.h | grep EREMOTEIO
#define EREMOTEIO 121@khm's explanation of a short read makes sense, but I don't see how that's possible in this environment. it's a qemu-kvm instance, the drive is virtio-blk-scsi backed by LVM with no IO errors on the host reported (or in qemu logs). nothing in the guest kernel logs either. I might understand it if the guest filesystem were damaged and it was a *read* but on a *write* ?
-
@ska I dunno, it's there on all my machines:
phendrana:~ eureka% cpp -dM /usr/include/errno.h | grep EREMOTEIO
#define EREMOTEIO 121@khm's explanation of a short read makes sense, but I don't see how that's possible in this environment. it's a qemu-kvm instance, the drive is virtio-blk-scsi backed by LVM with no IO errors on the host reported (or in qemu logs). nothing in the guest kernel logs either. I might understand it if the guest filesystem were damaged and it was a *read* but on a *write* ?
-
@ska I dunno, it's there on all my machines:
phendrana:~ eureka% cpp -dM /usr/include/errno.h | grep EREMOTEIO
#define EREMOTEIO 121@khm's explanation of a short read makes sense, but I don't see how that's possible in this environment. it's a qemu-kvm instance, the drive is virtio-blk-scsi backed by LVM with no IO errors on the host reported (or in qemu logs). nothing in the guest kernel logs either. I might understand it if the guest filesystem were damaged and it was a *read* but on a *write* ?
-
It's a bit annoying that the version macro was not there from the beginning. If you don't ship an openxr.h with your source code, I'd recommend putting something like this in your code:
```
#ifndef XR_API_VERSION_1_0
#define XR_API_VERSION_1_0 XR_MAKE_VERSION(1, 0, XR_VERSION_PATCH(XR_CURRENT_API_VERSION))
#endif
``` -
It's a bit annoying that the version macro was not there from the beginning. If you don't ship an openxr.h with your source code, I'd recommend putting something like this in your code:
```
#ifndef XR_API_VERSION_1_0
#define XR_API_VERSION_1_0 XR_MAKE_VERSION(1, 0, XR_VERSION_PATCH(XR_CURRENT_API_VERSION))
#endif
``` -
It's a bit annoying that the version macro was not there from the beginning. If you don't ship an openxr.h with your source code, I'd recommend putting something like this in your code:
```
#ifndef XR_API_VERSION_1_0
#define XR_API_VERSION_1_0 XR_MAKE_VERSION(1, 0, XR_VERSION_PATCH(XR_CURRENT_API_VERSION))
#endif
``` -
It's a bit annoying that the version macro was not there from the beginning. If you don't ship an openxr.h with your source code, I'd recommend putting something like this in your code:
```
#ifndef XR_API_VERSION_1_0
#define XR_API_VERSION_1_0 XR_MAKE_VERSION(1, 0, XR_VERSION_PATCH(XR_CURRENT_API_VERSION))
#endif
``` -
It's a bit annoying that the version macro was not there from the beginning. If you don't ship an openxr.h with your source code, I'd recommend putting something like this in your code:
```
#ifndef XR_API_VERSION_1_0
#define XR_API_VERSION_1_0 XR_MAKE_VERSION(1, 0, XR_VERSION_PATCH(XR_CURRENT_API_VERSION))
#endif
``` -
What's pretty neat is that I have http://wesl-lang.dev with its module system now! That means I can trivially consume https://lygia.xyz now :)
I'm also finding some interesting metaprogramming techniques between #alv and the modules, like basic polymorphism in this raymarching library:
pic one is the user code, pic two is the library implementation.
First the user declares the scene sample type they want to use by defining a shader module that contains a "Sample" type, an intial value, and a helper function that extracts the "distance" float from that type. This means they have complete autonomy over what material data they need (e.g. meterial identifiers, surface UVs, or whatever else).
That shader module can be passed to an alive function that returns another shader module that implements common distance field operations (union, difference etc) on top of these primitives.
Now the user can define a second shader module that contains the scene function (using the SDF utils), and give that back to the library which uses it to provide "castRay" and "calcNormal", which the primary user module can include to render the scene.
Unlike GLSL #define-type approaches, you could even instantiate multiple scenes with different result types if you wanted to
-
What's pretty neat is that I have http://wesl-lang.dev with its module system now! That means I can trivially consume https://lygia.xyz now :)
I'm also finding some interesting metaprogramming techniques between #alv and the modules, like basic polymorphism in this raymarching library:
pic one is the user code, pic two is the library implementation.
First the user declares the scene sample type they want to use by defining a shader module that contains a "Sample" type, an intial value, and a helper function that extracts the "distance" float from that type. This means they have complete autonomy over what material data they need (e.g. meterial identifiers, surface UVs, or whatever else).
That shader module can be passed to an alive function that returns another shader module that implements common distance field operations (union, difference etc) on top of these primitives.
Now the user can define a second shader module that contains the scene function (using the SDF utils), and give that back to the library which uses it to provide "castRay" and "calcNormal", which the primary user module can include to render the scene.
Unlike GLSL #define-type approaches, you could even instantiate multiple scenes with different result types if you wanted to