It is a complex matter and since I am not lawyer, chances are that I got some (most) things wrong.
Nevertheless, I know that things may change depending on the country. For instance, I am pretty sure that writing an answer on a public forum counts as publication. In Europe, once an idea is published, it cannot be patented anymore (a patent is valid only if it was filed before publication). In the US, however, the idea author can file the patent up to one year after publication.
There are several distinct concepts:
Authorship. Whoever wrote the answer is the author of that answer. In the US, the author can renounce authorship by claiming the answer to become "public domain". This is not doable under French law: "une œuvre de l'esprit" (an intellectual creation) enters public domain only quite some time (70 years, I think) after the death of the last author, and there is no possible renouncement. The author always has the possibility of "having remorse" and requesting all copies of the creation to be destroyed (of course, owners and users of such copies may be entitled to receive appropriate compensation).
Copyright. This is an anglo-saxon term which describes the set of rules governing the right to copy the creation, or part thereof. All the content submitted to a stackexchange site falls under the CC-BY-SA license (just click on the icon on the lower right corner of this page for details). This is part of the usage terms for the site. So you can copy answers (the text itself, that is) under the CC-BY-SA terms, which basically means that you must keep attributions, and you cannot distribute the copy under a more restrictive license (in that way, the CC-BY-SA license is similar to the GPL). Note that regardless of copyright, you can always quote small excerpts of any published work, where the definition of "small" is byzantine (I heard something like "at most seven lines" but without any clear definition of the maximum size of a line).
Licenses. Licenses are texts describing what you can do with a given intellectual creation. Licenses and copyright are not the same thing, but they are not completely orthogonal either. The CC-BY-SA license uses the copyright framework in order to enforce rules on usage. Licenses are often used for software, where "reuse" is usually not a simple verbatim copy -- hence the notion of "derivative work". The CC-BY-SA license can work with code too. If you reuse some code from a SE answer then you are bound by the CC-BY-SA license terms. Note, though, that there is a subtle distinction between importing some code, and learning from some code. A license cannot prevent you from using as you see fit under whatever license you want some concept that you learnt by looking at some code, especially if that code was shown to you as an explicit pedagogical illustration in the first place. The frontier between import and learning is somewhat fuzzy.
Patents. Patents apply on ideas or mechanisms. There again, it depends on the country; theoretically, one cannot patent software in Europe. A patent is a time-limited monopoly granted to someone on the commercial exploitation of a given idea/mechanism, in exchange for a publication of said idea/mechanism -- it was meant to promote innovation by avoiding the loss of ideas which were kept secret by their inventors in order to secure market value. That someone describes an idea in a SE message is not exclusive of the existence of a patent on that idea, possibly a patent which will be filed in a few months (at least in the US). I do not think that the CC-BY-SA licence applied on the whole of stackexchange could be interpreted as a generic usage license grant, in case the message author is also the patent owner -- but maybe it could be sustained in court. Patent law is a weird thing.
Other laws (especially export and import laws on cryptographic material). If someone posts some cryptographic code on crypto.SE, then the stackexchange servers will begin to spread that code worldwide, thus realizing an export (from the country in which the stackexchange servers are); each reader further imports the code in his own country, if that country happens not to be the same than the one hosting the stackexchange servers. In practice, I do not think that much trouble is expected that way; however, the stackexchange server operators might want to include a disclaimer by which whoever reads the site claims not to be, say, a citizen of North-Korea (Kim Jong-Il, current North Korean leader, is known to have an Internet access).
From a practical point of view, I think that most contributors to stackexchange sites do not care about what could be done with code snippets they post, regardless of licenses under which derivative works are distributed; and almost all of those who care would be content with just their nickname somewhere in a comment in the source code. So let's be relaxed. This site is about learning, and learning is, by definition, unlimited.