unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Static Asserts
@ 2010-06-19 19:43 Noah Lavine
  2010-06-20 13:58 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Noah Lavine @ 2010-06-19 19:43 UTC (permalink / raw)
  To: guile-devel

Hello,

I discovered that my previous build failure was not because of a
Makefile issue but because my modifications had changed the size of
struct scm_objcode, which broke other parts of the program. I found
several files where structs are cast from bytes using #define'd
values, which are most likely the problem.

It wouldn't be too hard to change these headers to work with my code,
but that wouldn't be very future-proof. I'd like to add some mechanism
so that if sizeof(struct scm_objcode) ever changes again, it will be
obvious that there is a problem. It seems to me that the best way to
do this is some sort of assertion. I'd like to pick an assert
mechanism that is acceptable to the Guile developers. Therefore, my
question is this: what sort of compile-time assert mechanism would you
like to see?

There is a whole list of options at
http://stackoverflow.com/questions/174356/ways-to-assert-expressions-at-build-time-in-c
, most of which are probably equivalently effective - it's just a
matter of picking one and adding it to a Guile header.

Thanks
Noah



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Static Asserts
  2010-06-19 19:43 Static Asserts Noah Lavine
@ 2010-06-20 13:58 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2010-06-20 13:58 UTC (permalink / raw)
  To: guile-devel

Hi,

Noah Lavine <noah.b.lavine@gmail.com> writes:

> I discovered that my previous build failure was not because of a
> Makefile issue but because my modifications had changed the size of
> struct scm_objcode, which broke other parts of the program. I found
> several files where structs are cast from bytes using #define'd
> values, which are most likely the problem.
>
> It wouldn't be too hard to change these headers to work with my code,
> but that wouldn't be very future-proof. I'd like to add some mechanism
> so that if sizeof(struct scm_objcode) ever changes again, it will be
> obvious that there is a problem. It seems to me that the best way to
> do this is some sort of assertion. I'd like to pick an assert
> mechanism that is acceptable to the Guile developers. Therefore, my
> question is this: what sort of compile-time assert mechanism would you
> like to see?

We already use Gnulib’s ‘verify’ macro in some places (see
‘lib/verify.h’).  If you stumble upon a missing assertion, please do
post a patch.  :-)

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-20 13:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-19 19:43 Static Asserts Noah Lavine
2010-06-20 13:58 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).