public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alan McKinnon <alan.mckinnon@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] package.keywords syntax?
Date: Wed, 29 Oct 2008 09:16:29 +0200	[thread overview]
Message-ID: <200810290916.29649.alan.mckinnon@gmail.com> (raw)
In-Reply-To: <38af3d670810281555j43a2c0dfl990860eb9b85921b@mail.gmail.com>

On Wednesday 29 October 2008 00:55:42 Jorge Peixoto de Morais Neto wrote:
> >> I mean to really know C,
> >> that is, read a rigorous book such as "C: A Reference Manual" and be
> >> able to write portable programs with well-defined behavior. Speaking
> >> of well-defined behavior, do you know what happens when you cast a
> >> float to an int, and the float is too big to fit into the int?
> >
> > Did oyu try it yourself and see?
>
> The point is that the behavior in this situation is "undefined". It
> might do anything. Programming in C is different than programming in
> Python.

Most likely the compiler will try to treat the float as an int and use the 
first 4 bytes of the float, ignoring the rest.

This is insane though. I cannot think of any reason why one would ever want to 
treat the first 32 bits of a float as an int. It's not like you are casting a 
long to an int which can make sense - just discard the high bits.

I reckon the standard would say this is undefined. Most compiler would bomb 
out with a compile error but give you an obscure flag to proceed anyway. If 
you want to commit suicide, C is quite happy to pass you the pills as long s 
you ask nicely

-- 
alan dot mckinnon at gmail dot com



  reply	other threads:[~2008-10-29  7:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-28 17:07 [gentoo-user] package.keywords syntax? Helmut Jarausch
2008-10-28 17:20 ` Neil Bothwick
2008-10-28 17:22 ` Andrey Vul
2008-10-28 17:39   ` Ricardo Saffi Marques
2008-10-28 17:49     ` Neil Bothwick
2008-10-28 20:29     ` Andrey Vul
2008-10-28 21:01       ` Alan McKinnon
2008-10-28 21:34         ` Jorge Peixoto de Morais Neto
2008-10-28 21:47           ` Robert Bridge
2008-10-28 21:56           ` Alan McKinnon
2008-10-28 22:17             ` Jorge Peixoto de Morais Neto
2008-10-28 22:41               ` Alan McKinnon
2008-10-28 22:55                 ` Jorge Peixoto de Morais Neto
2008-10-29  7:16                   ` Alan McKinnon [this message]
2008-10-29 14:16                     ` Andrey Vul
2008-10-29 20:13                     ` Jorge Peixoto de Morais Neto
2008-10-30 10:46                       ` Dirk Uys
2008-10-30 11:00                         ` Dirk Uys
2008-10-30 18:54                           ` Jorge Peixoto de Morais Neto
2008-10-30 19:11                             ` Albert Hopkins
2008-10-31  8:02                               ` Dirk Uys
2008-10-31  9:54                               ` [gentoo-user] OT: Python (was: package.keywords syntax?) Matthias Bethke
2008-10-31 10:31                                 ` Heiko Wundram
2008-10-30 19:12                         ` [gentoo-user] package.keywords syntax? Jorge Peixoto de Morais Neto
2008-10-31  7:57                           ` Dirk Uys

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200810290916.29649.alan.mckinnon@gmail.com \
    --to=alan.mckinnon@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox