Dont know galathaea. I only get a '!' when yours prints out.
I think you missed a 1ll
Printable View
Dont know galathaea. I only get a '!' when yours prints out.
I think you missed a 1ll
Weird... I copied and pasted from a working program (going through Yves' formatter) and everything looks ok... I'll check it out to try and see what's up...
Copying out of the code I posted into CodeWarrior on my mac compiles and runs just fine (version 5.0 --- ugh). It was written on VC++.NET (the 7.0, 2002 version) and runs fine there.
It might not work if your compiler does not support function template specialization or will not recurse templates 12 levels deep, but those language features have been in in alot of compilers for some time... I'll try MingW and DevC++ tomorrow at work just to see how they do.
Well, galathaea, I have just compiled your code under Linux with g++ and it works fine :) So, it is reallly obfuscated, yeh :cool:
That's really nice :)Quote:
Originally posted by galathaea
Here's my throw into the bucket (free time at work today: say yay!).
:DCode:/* obfuscated */
MSVC 6.0 prints "!". I tried tracing it. From main, the app jumps to the template specialization <1>. I know MSVC 6.0 has problems with template specialization, but that's why some people will not see "Hello World!".
- Kevin
P.S. main() should return something. Probably 111111 from the looks of your app.
Ok, that was VC6. .net its ok :DQuote:
It might not work if your compiler does not support function
template specialization or will not recurse templates 12 levels
deep
well,
works on all compilers.Code:int main()
{
std::cout << "Hello World!!";
return 0;
}
<nitpick>Quote:
Originally posted by mwilliamson
well,
works on all compilers.Code:int main()
{
std::cout << "Hello World!!";
return 0;
}
Well...it would rather say
works on all compilers since the STL is not part of every compiler (like C compilers etc.) :DCode:int main()
{
printf("Hello World!!");
return 0;
}
</nitpick>
Stupid human trick, but execute Gal's code with a
int main()
{
<unknown> func;
throw 10101010;
return 0;
}
how bout this
:p :DCode:void main() {
int i=0;
while("Hello World!"[i]) putchar("Hello World!"[i++]);
}
that's the more optimized version:pCode:void main()
{
int i=0;
while(putchar("Hello World!!"[i++]));
}
it's a pitty that this doesn't work
:DCode:void main()
{
while(putchar("Hello World!!"++)); // not working code :(
}
just wrote this:
it's kinda neet :p :D ;)
Code:#include <stdio.h>
#include <vector>
typedef char __sys_dd_64;
namespace hello_world {
template<class _syst_ch_typed_but_not_pointer_>
struct __sys_dd_64_container_ {
__sys_dd_64_container_(_syst_ch_typed_but_not_pointer_ tt) : m_tt1(tt) { m_tt2 = m_tt3 = m_tt1; }
operator _syst_ch_typed_but_not_pointer_() const {
return m_tt3,m_tt1,m_tt3-m_tt1,m_tt2;
}
_syst_ch_typed_but_not_pointer_ get_data() const {
return (_syst_ch_typed_but_not_pointer_)*this;
}
typedef _syst_ch_typed_but_not_pointer_ _internal_val_t;
private:
_syst_ch_typed_but_not_pointer_ m_tt1;
_syst_ch_typed_but_not_pointer_ m_tt2;
_syst_ch_typed_but_not_pointer_ m_tt3;
#define Stfd_gf(ss) p##ss##ar
unsigned long lSize;
friend void main();
static const int _read_sys_(_syst_ch_typed_but_not_pointer_ tt) { Stfd_gf(utch)((__sys_dd_64)tt); return -64; }
};
} // namespace hello_world
typedef hello_world::__sys_dd_64_container_<__sys_dd_64> __container_type;
void main()
{
static const hello_world::__sys_dd_64_container_<__sys_dd_64> _strdf_[] = {
(hello_world::__sys_dd_64_container_<__sys_dd_64>)'\0',(hello_world::__sys_dd_64_container_<__sys_dd_64>)'\n',
(hello_world::__sys_dd_64_container_<__sys_dd_64>::_internal_val_t)'!',(hello_world::__sys_dd_64_container_
<__sys_dd_64>::_internal_val_t)'d', (hello_world::__sys_dd_64_container_<__sys_dd_64>)'l',
(hello_world::__sys_dd_64_container_<__sys_dd_64>)'r',
(hello_world::__sys_dd_64_container_<__sys_dd_64>::_internal_val_t)
'o',(hello_world::__sys_dd_64_container_<__sys_dd_64>)
'W',(hello_world::__sys_dd_64_container_<__sys_dd_64>)' ',
(hello_world::__sys_dd_64_container_<__sys_dd_64>)'o' ,
(hello_world::__sys_dd_64_container_<__sys_dd_64>)'l',
(hello_world::__sys_dd_64_container_<__sys_dd_64>)
'l',(hello_world::__sys_dd_64_container_<__sys_dd_64>::_internal_val_t)'e',
(hello_world::__sys_dd_64_container_<__sys_dd_64>)'H'
};
for (std::vector<__container_type>::const_iterator __i=_strdf_+sizeof(_strdf_)/
sizeof(_strdf_[3])-1, j=0; __i!=__i-(unsigned int)j*
sizeof(_strdf_[0])+sizeof(_strdf_)/sizeof(_strdf_[2
]); hello_world::__sys_dd_64_container_<__container_type>::_read_sys_((__sys_dd_64)((__i--)->get_data())),
++j,!*__i
?exit(0)
:true
); //for
}
[QUOTE]Originally posted by SeventhStar
Your program doesn't follow the standart, because ofCode:void main()
{
int i=0;
while(putchar("Hello World!!"[i++]));
}
void main()
:D;)
Standards are for those that can't think outside of the box so they must impose a think inside of this box :)