in many code i see that type of "something". anybody explain please.
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3792 |
| 2 | VivaciousAubergine | 3647 |
| 3 | Kevin114514 | 3603 |
| 4 | jiangly | 3583 |
| 5 | turmax | 3559 |
| 6 | tourist | 3541 |
| 7 | strapple | 3515 |
| 8 | ksun48 | 3461 |
| 9 | dXqwq | 3436 |
| 10 | Otomachi_Una | 3413 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 157 |
| 2 | adamant | 153 |
| 3 | Um_nik | 147 |
| 4 | Proof_by_QED | 146 |
| 5 | Dominater069 | 145 |
| 6 | errorgorn | 141 |
| 7 | cry | 139 |
| 8 | YuukiS | 135 |
| 9 | TheScrasse | 134 |
| 10 | chromate00 | 133 |
in many code i see that type of "something". anybody explain please.
| Name |
|---|



It sets stack size. If you don't write it, your solution may crash with stack overflow (in deep recursive functions, for example).
The only thing to add is that it's MS Visual C++-specific and won't work with GCC. In GCC you should specify
-Wl,--stack=256000000command line option to set stack size (in bytes).thats nice. by the by whats the default gcc stack size?
2MB. You can see this in the headers of .exe produced by MinGW.
Parameter
--stackcan be used only with MinGW. ;)so how increase stack in g++ under CNU/Linux?
Nohow. Stack size is a user limit under GNU/Linux and doesn't depend on compiler. You can use
ulimit -sto change/view it.can you tell me exactly what should I write in the code for GCC compiler to increase the stack size?
If inline assembler is allowed, you can allocate a block of memory using
mallocand move the stack pointer to that newly allocated block. AFAIK, it's the only way of increasing the stack size from the code in GCC. Sorry, but I don't know AT&T syntax, which is used by GNU Assembler, so I can't write the code.But in MSVC (which uses Intel syntax) it'd look like this:
UPD. Fixed an error.
You are not able to modify stack size from source code using GCC, afaik (however, I've heard that there were some extensions in the latest versions of GCC, but I don't know exactly). The only way to do so was described above. For example, in Windows you can use the following command line:
g++ -o app.exe -Wl,--stack=256000000 -O2 source.cppThanks both of you very much.
“#pragma comment(linker, ”/STACK:36777216“)” Is it usable only in the on-line judge or anywhere you want?
It's usable anywhere with Microsoft Visual C++ — on your local machine and so on.