<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#3333FF" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 2013-07-20 17:25, David Blaikie
wrote:<br>
</div>
<blockquote
cite="mid:CAENS6Es8EpcT_WrVPJk3ewF1=q5htRCdz+QkLo-ixABXLZ89NQ@mail.gmail.com"
type="cite">
<pre wrap="">On Sat, Jul 20, 2013 at 6:46 AM, Sian Mountbatten
<a class="moz-txt-link-rfc2396E" href="mailto:poenikatu@fastmail.co.uk"><poenikatu@fastmail.co.uk></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Dear List
I have a small program which contains the code shown on page 1058 of
Stroustrup's TC++PL (4th ed.) just above the 37.2.1 section. I omitted
the line which initialises (and declares) pat1.
</pre>
</blockquote>
<pre wrap="">
Not everyone has a copy of TC++PL on hand, perhaps you could provide
the code you are compiling?
</pre>
<blockquote type="cite">
<pre wrap="">If I compile the file main.cpp to regex using this command:
clang++ -g -std=c++11 -stdlib=libc++ -o regex main.cpp
I get no warnings, no errors, in fact no console output from clang++.
When the program is run, it produces "\w+\d*" on the console.
</pre>
</blockquote>
<pre wrap="">
If you avoid initializing a variable you may get undefined behavior,
which isn't going to be reliable.
</pre>
<blockquote type="cite">
<pre wrap="">Now, if I compile with this command:
clang++ -g -std=c++11 -o main.o -c main.cpp
and then link with this command:
clang++ -g -stdlib=libc++ -o regex main.o
again, I get no output from clang++. Unfortunately, when the output
program is run, it fails with "Segmentation violation".
</pre>
</blockquote>
<pre wrap="">
Again, I'm assuming you've invoked UB & the two different standard
libraries are just failing in different ways. Once we see the code,
that might change.
</pre>
<blockquote type="cite">
<pre wrap="">Does this mean that when I start writing programs which are made up
of many source files, I shall be unable to compile the individual files?
</pre>
</blockquote>
<pre wrap="">
I don't understand this question, well maybe - no, there shouldn't
really be any difference between compiling and then linking and
compiling+linking in one go. But UB is UB (though I'd still be
surprised if that actually behaves differently)
</pre>
<blockquote type="cite">
<pre wrap="">I am trying to use Code::Blocks as the IDE for clang++. The commands it
issues are peculiar and, especially, the linker is, I reckon, just plain
wrong. The point is that the Code::Blocks binary also fails with a
Segmentation violation.
So what's going wrong? Can clang++ act, not only as a compiler, but also a
linker?
</pre>
</blockquote>
<pre wrap="">
Both GCC and Clang (& many other compilers) can act as wrappers around
assemblers and linkers. They just invoke the assembler (well,
Clang/LLVM has an integrated assembler too, so it doesn't invoke
another process to assemble) or linker with the relevant arguments
(such as figuring out the right libraries to link for the standard
library, etc)
</pre>
<blockquote type="cite">
<pre wrap="">And is it possible to use a debugger from the LLVM stable rather
than
GNU gdb?
</pre>
</blockquote>
<pre wrap="">
There is a debugger under the LLVM project, called LLDB - it's not
very mature & even less so on Linux. Clang's debug info should operate
perfectly well with GDB, if it doesn't, please file bugs.
</pre>
<blockquote type="cite">
<pre wrap="">
Looking forward to progessing on these points.
--
Sian Mountbatten <<a class="moz-txt-link-abbreviated" href="http://www.poenikatu.co.uk">www.poenikatu.co.uk</a>>
Learning C++!!!
I'm an FSF member (no. 10888)
Help us support software freedom! <a class="moz-txt-link-freetext" href="http://www.fsf.org/jf?referrer=10888">http://www.fsf.org/jf?referrer=10888</a>
_______________________________________________
cfe-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a>
</pre>
</blockquote>
</blockquote>
<font face="DejaVu Sans Mono"><a class="moz-txt-link-freetext" href="http://paste.debian.net/17301">http://paste.debian.net/17301</a></font><br>
<br>
<pre class="moz-signature" cols="72">--
Sian Mountbatten
Learning C++!!!
I'm an FSF member
Help us support software freedom! <a class="moz-txt-link-freetext" href="http://www.fsf.org/jf?referrer=10888">http://www.fsf.org/jf?referrer=10888</a>
</pre>
</body>
</html>