Giter Club home page Giter Club logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Hi,

This is odd; the compiler should not be giving a link failure on this as of the 
C++ standard (if it does, a lot of legal code will break). What version are you 
using?

Original comment by [email protected] on 20 Jun 2011 at 10:02

from snappy.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
I'm using:
CC: Sun C++ 5.11 SunOS_i386 2010/08/13

When I'm building I see stuff like:
libtool: link: ( cd ".libs" && rm -f "libsnappy.la" && ln -s "../libsnappy.la" 
"libsnappy.la" )
source='snappy_unittest.cc' object='snappy_unittest-snappy_unittest.o' 
libtool=no \
    DEPDIR=.deps depmode=none /bin/sh ./depcomp \
    CC -DHAVE_CONFIG_H -I.      -g -c -o snappy_unittest-snappy_unittest.o `test -f 'snappy_unittest.cc' || echo './'`snappy_unittest.cc
"snappy_unittest.cc", line 125: Warning: Identifier expected instead of "}".
1 Warning(s) detected.
source='snappy-test.cc' object='snappy_unittest-snappy-test.o' libtool=no \
    DEPDIR=.deps depmode=none /bin/sh ./depcomp \
    CC -DHAVE_CONFIG_H -I.      -g -c -o snappy_unittest-snappy-test.o `test -f 'snappy-test.cc' || echo './'`snappy-test.cc
/bin/sh ./libtool --tag=CXX   --mode=link CC  -g   -o snappy_unittest 
snappy_unittest-snappy_unittest.o snappy_unittest-snappy-test.o libsnappy.la 
-lz    
libtool: link: CC -g -o .libs/snappy_unittest snappy_unittest-snappy_unittest.o 
snappy_unittest-snappy-test.o  ./.libs/libsnappy.so -lz -R/usr/local/lib
Undefined           first referenced
 symbol                 in file
char*snappy::internal::CompressFragment(const char*,unsigned,char*,unsigned 
short*,const int) snappy_unittest-snappy_unittest.o
ld: fatal: symbol referencing errors. No output written to .libs/snappy_unittest
gmake[1]: *** [snappy_unittest] Error 2
gmake[1]: Leaving directory `/tmp/snappy-read-only'
gmake: *** [all] Error 2

If I'm inspecting the names in there I see:
trond@storm:2028> nm .libs/libsnappy.so | grep CompressFragment
[127]   |     19024|      2762|FUNC |GLOB |0    |12     
|__1cGsnappyIinternalQCompressFragment6FkpkckIpcpHki_6_
trond@storm:2029> nm snappy_unittest-snappy_unittest.o | grep CompressFragment
[290]   |         0|         0|FUNC |GLOB |0    |UNDEF  
|__1cGsnappyIinternalQCompressFragment6FpkcIpcpHki_4_

and if I try to demangle the functions I see:

trond@storm:2030> nm .libs/libsnappy.so | grep CompressFragment | c++filt
[127]   |     19024|      2762|FUNC |GLOB |0    |12     
|char*snappy::internal::CompressFragment(const char*const,const 
unsigned,char*,unsigned short*,const int)
trond@storm:2031> nm snappy_unittest-snappy_unittest.o | grep CompressFragment 
| c++filt
[290]   |         0|         0|FUNC |GLOB |0    |UNDEF  
|char*snappy::internal::CompressFragment(const char*,unsigned,char*,unsigned 
short*,const int)

I have to admit that I don't know the C++ standard good enough, but why use a 
different signature for the prototype and the implementation? This is the first 
time I've seen this "problem" so I'd like to know why doing so is a good thing?


Original comment by [email protected] on 20 Jun 2011 at 8:34

from snappy.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
[repaste; my answer went to the mailing list only]

For the same reason you don't put the entire implementation in the
header file, really. The fact that the int not changed inside the
implementation is irrelevant to the caller (the calling convention is
identical), and as such the caller should not care, nor should the
external user need to know about it.

I did some digging around, and seemingly this is just the Sun compiler
being known-broken (and Sun does not want to change it, as fixing this
would break backwards compatibility). I'm mildly tempted to just say
“use a standards-compliant C++ compiler”, but I guess the fix is
non-intrusive enough to include. I'd probably do it the other way
round, though, removing the consts in the .cc file; they shouldn't
affect code generation, and it gives more freedom to change the
implementation later without breaking the ABI (on this compiler).

Original comment by [email protected] on 21 Jun 2011 at 12:14

from snappy.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 19, 2024
Hi,

Fixed in r44. Sorry about the late push.

Original comment by [email protected] on 28 Jun 2011 at 11:41

  • Changed state: Fixed

from snappy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.