I bet none of ya can make a c++ prog less than 10kb :)
Printable View
I bet none of ya can make a c++ prog less than 10kb :)
Can you?
i just compiled
int main(){}
and it was 656098
using g++.
i don't have access to my compiler right now but i think
int main()
{
return 0;
}
might do it
Nope. Tried that and alot of other things. All gave me the same size : 56.0 KB / 51.0 KbQuote:
int main()
{
return 0;
}
Ok hotshot, show us if you can do it!!:D
hmm
void main()
{
}
mmmm....Quote:
void main()
{
}
NOPE tried that as well!!
C++ is a high level language so its not possible.
DAMMIT!
hmmmmmmm
no clue dude
Smallest is 24.0KB with VC++
void main(){} or int main(){}
doesn't matter which.
gave me 13k here...Code:int main () {
return 0;
}
I made a program in C++ that was 955 bytes long.
All it does is cause a segmentation fault, but it compiles and executes!
>Smallest is 24.0KB with VC++
This'd do it on MSVC++ -
With the linker options -Code:#define main mainCRTStartup
int main()
{
return 0;
}
/NODEFAULTLIB /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /MACHINE:IX86
Comes in at exactly 1 KB. You may be able to get it lower than that by tinkering with the options a little more. It's not really a valid C++ program but I'd guess most compilers have the option of turning off the default runtime.
Removing the /NODEFAULTLIB in MSVC and compiling with the standard main produces a 3.5KB exe.
But does it execute?
>But does it execute?
Yes, but you'd have problems unless you want to code some of the start up runtime yourself.
worked for me. it was 3072 bytes. As long as i only use stuff in cstdio.h, i haven't been able to go OVER 10kb.Code:#include <cstdio>
int main(int argc, char *argv[]){
for (int i=0; i<100000000; i++){
printf("Hey! this is less than 10kb.");
}
return 0;
};
~Inquirer
Are you sure that is the binary?
hehe. Nevermind.
For some reason, the file stayed open, and DEV stopped writing to it when it complied, so after i compiled void main(){}; it never changed the file size, or the program on disk.
~Inquirer