Turecko-americká vycházející matematická hvězda Levent Alpöge ze společnosti Anthropic vyvolal pozdvižení oznámením (PDF), že s pomocí superinteligence Claude od Antropicu dokázal vyřešit jeden ze sedmi největších matematických problémů tisíciletí, slavnou Riemannovu hypotézu (prvočísla se mezi čísly objevují zdánlivě nepravidelně, hypotéza tvrdí, že za jejich rozmístěním je určitý řád). Svůj důkaz uvolnil jako open-source
… více »
$ cat implicit.cc
#include <iostream>
int f(int a, int = 2, int c = 3);
int f(int a, int b, int c)
{
std::cout << a << " " << b << " " << c << std::endl;
return 0;
}
int main(void)
{
f(1);
f(2, 3);
f(3, 4, 5);
}
$ g++32 -Wall implicit.cc ; ./a.out
1 2 3
2 3 3
3 4 5
$ g++32 --version
g++32 (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-47.fc4)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$
#include <iostream>
void f1( int, ... )
{
std::cout << "f( int, ... )\n";
}
void f2( int, int = 0 )
{
std::cout << "f( int, 0 )\n";
}
int main()
{
f1( 1 );
f2( 1, 2 );
return 0;
}
Pokud se budou jmenovat stejne, napr. "f":
elviin@nilix>g++ test.cpp </tmp test.cpp: In function `int main()': test.cpp:17: error: call of overloaded `f(int)' is ambiguous test.cpp:4: error: candidates are: void f(int, ...) test.cpp:10: error: void f(int, int)... ale to je jina kapitola.
Tiskni
Sdílej: