| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12
Comments:
<0> void Foo(); <1> but what do you mean about "see from a function declaration" <1> see what? the stars? your own arsehole without a mirror? what?!?! ;) <0> I mean "given a function declaration" <2> check the contents of the function, (header, body) to see if there's any c++-only syntax. <1> ah i get it <2> to determine if the function is either definitely c++ or either c++ or c. <0> There is no body, just the declaration. <2> for shame. <1> well i mean you could write a C parser and c++ parser and see if either accept the string heh <1> but within the language itself?! <0> A template will be C++, a func decl with a (return) type that contains the scope operator (::) will be C++, right? <2> i don't know of any other identifying characteristics. <0> Can structs have member functions in C? :) <1> no, structs cannot <2> they can in c++...
<1> also if you have reference parameters it's c++, as well as default parameter values, that's not C <2> i dunno about that.. <0> Lemme look for a declaration now that contains a quote... if there isn't one, then I don't have to worry about a "::" between quotes. <1> hmm what else? oh and i think if you do: foo() a strict C compiler should complain it should be written as -- foo(void) <3> if it's compiled in a C++ compiler and not in an extern "c" block, it's C++ <1> yes, that is true as well. <3> Trying to determine it by source code analysis is an exercise in frustration <4> lo, guys, what's up? <1> hey speaking of that.. asriel.. what is the best policy on function pointers p***ed to C functions (like signal() or pthread_create()).. is it best to declare those as extern "C"? <4> Nilac it shouldn't matter <1> i never bother declaring them as extern C because i have never seen it fail.. <4> the pointer has resolved all the decorating issues <1> vawjrwrk, yeah i figured it shouldn't since C and C++ both have pretty much the same calling convention <1> and the extern thing was only for mangling issues, right? <3> linkage issues, but basically eys <4> well, it's for mangling/decorating issues for sure...there might be others <1> can extern "C" functions still throw exceptions? heh.. <1> and if so.. is that bad? <5> btw, if one declaration has c++ stuff, the rest of the declarations in the same file are c++ as well :P <5> #includes of <cplusplus_header> are a good indication of c++ as well <5> heh <4> what sparked this discussion? <5> Run <5> lol <0> I see no " in any function declaration of this project... but that doesn't say much. <0> Can't some template parameter (literal) contain a quote? <1> run what do you mean about quotes? <1> run: yes, i mean if the parameter would then be of type const char * const... <0> The type of declarations I have here like this: <0> void std::vector<_Tp, _Alloc>::push_back(const _Tp&) [with _Tp = std::string, _Alloc = std::allocator<std::string>] <0> There is no '"' in there. <0> I wonder if it's possible to have something like .. with _Tp = "some \"::\" string", ... <2> but there's scope resolution... <0> In other words: do I need to parse quotes or not. <4> I'm lost <2> ah <2> you might as well parse them, just in case.. <1> i think a declaration can contain quotes if it gives default parameters, etc.. <5> just get a normal lexer and voila <0> I suppose can be fairly sure that any template will contain a '<' and no C function will contain a '<'. <4> outside of <4> ".." yes <2> i'm hungry. <1> for instance: void foo(const char * str = "blah"); <0> Nilac: Ok, but there are no default parameters at linker level, and these declarations only show what the linker/demangler sees. <4> did they make that legal in C99? <1> vawjrwrk, what's so illegal about it? <1> Run, ah, i see. nevermind. :) <4> Run working on the demangler again? <0> no <0> This is printed directly by the compiler (a patched compiler, to make it print this) <0> I suppose the compiler knows what language it is, and I could have it print that too... but I think it's simpler to just parse it :p <0> Can't be that hard to see if it's C++ or not. <1> vawjrwrk, oh wait i just understood your C99 comment.. i didn't realize c99 also has default params now.. wow <4> Nilac I don't know that it does, that was a question I asked, not a statement <1> oh <0> I threw away the most obvious C++ functions now: those containing "::" and those containing a "<". <0> That still leaves me with C++ declarations: <0> "int __cxa_atexit(void (*)(void*), void*, void*)" <0> "void operator delete [](void*)"
<1> in some ways i find it a bit unsettling how C99 is more liberal about some things than C++ <4> I find it unsettling that it exists <0> Hmm, that's it. So, if I scan for 'operator' and '(*)' I'd have caught everything for THIS project... but I'm not sure that will work in general. <0> It's the void (*)(void*) that isn't C I thought... maybe I'm wrong. <1> no run, that's C allright <0> I haven't done C for too long :/ <0> There was some big different between C and C++ there though :/ <0> overloading? <1> on what? function pointers? <1> well C++ supports pointers to members <1> which of course C doesn't since there are no members to speak of.. <0> Hmm... C functions don't have parameter types at ALL. <1> at the link level? i wouldn't be surprised.. <0> But this prints them anyway, so the only way to detect C++ here then is to see if there are any functions overloaded. <0> If I see "int f(int)" then that can be C, but when I also see "int f(float)" then I know 'f' is a C++ function... I suppose. <0> Grrmbl. <0> Ok, this isn't going to work thus. <0> Once could have an extern "C" int f(int); and a normal int f(float); in a C++ file. Then I can't know which is C and which is C++. <0> s/Once/One/ <0> Lemme try that... <1> hey what's that about the unnamed namespace? stuff in it is always static? <0> no <0> I think it's exported, you just don't know the name of the namespace. <1> so how do you refer to it? <1> or you can't? <1> ooutside of it.. <0> you can't <4> operator would be a legal name in C wouldn't it? <1> so you can have namespace { int foo; } namespace { int foo; } in the same file and it will be two different foo's? <1> and whey will never clash? <4> Nilac I don't think so <1> i wonder how the compiler goes about doing that bit of mangling.. i guess it doesn't export the names <0> "int test()" <0> "int test(float)" <0> Hey hey! It prints () for the extern "C"! Not (int). <4> and of course it doesn't expport the names.... the whole point of unnamed namespace is that <1> so it's equivalent to static linkage? <0> It *does* export it. <0> /usr/src/cppgraph/cppgraph-objdir/src>nm -C troep.o <0> 00000000 T (anonymous namespace)::f(int) <0> 'T' means it's a totally normal (exported) function. <0> Nilac: yes <0> But not because it isn't exported, but because you can't name it from outside the same compilation unit. <1> just why does it export it then? does that mean two namespace { int foo; } in two different translation units end up referring to the same foo? <0> With dlopen and some bit-level tricks you would still be able to link with it. <0> Just need to find the name ;) <0> (in my last test case, that would be: _ZN37_GLOBAL__N_troep.cc_00000000_795DA9251fEi) <0> If you ignore the anon namespace mangling there (the _GLOBAL_N_), the name would be: <0> int _GLOBAL__N_troep.cc_00000000_795DA9251::f(int); <0> (apart from that '.' is illegal in function names) <1> actually the compiler makes anonymous namespaces contain the filename from whence they came.. neat.. so they are effectively static.. just they are exported :) <0> The name of the namespace is uniq for that compilation unit: it exists of the name of the compilation unit (troep.cc) plus something that makes it uniq inside that per anon namespace PLUS a random hash (just to be sure). <6> mmm... hash... <7> http://today.reuters.com/news/newsarticle.aspx?type=oddlyEnoughNews&storyid=2006-01-13T141713Z_01_EIC351411_RTRUKOC_0_US-VAMPIRE.xml <0> Well, it's not random... and this is only for g++ of course. <7> Sharkey also pledged to execute convicted murders and child molesters personally by impaling them on a wooden pole outside the state capitol. <7> hahaha <7> that's the best part <0> sick <0> Anyone if favour of torture should be kicked out of politics immediately. <6> that's not torture. <6> you'd die pretty quick. <0> yeah right <6> maybe cruel and unusual... <0> I'd prefer a bullet through the head. <8> depends on where they are impaled <8> through the stomach wouldn't be that pleasant <6> indeed. <6> torture implies the possibility of survival. <8> hilarious political stance, however <0> This is torture till death, and you know it. Don't give me this **** NineVolt <6> i guess. <0> It's disgusting.
Return to
#c++ or Go to some related
logs:
resimtakasi What is a pipistrel or a flittermouse ?
Pi-ADL #linux deeza #linux #ubuntu ubuntu valarray #teens yourporn
|
|