shlomif | vdamewood: hi! sup? I don't like the fact that the new ##programming faq is neutered of links. seems like in your intolerance of me you've philosophised yourself into a corner. :P we're going to lose The-Game™ |
Inline | erm, if you get bored of one corner then philosophize yourself onto the other corner.... |
Inline | lol |
shlomif | Inline: heh. |
shlomif | Inline++ |
shlomif | http://ars.userfriendly.org/cartoons/?id=20060302 |
candide | Title of shlomif's link: UserFriendly Strip Comments |
Inline | at least it's raining metaphysics erry day..... |
Inline | hahaha |
shlomif | that strip is a remake of https://www.youtube.com/watch?v=KNYI3iINXrQ |
candide | Title of shlomif's link: Sam the Eagle versus Alice Cooper - YouTube |
shlomif | Inline: metaphysics is my favourite physics ;) |
* Inline | goes take a swim in the sea of concepts then comes out and holds his bucket in the air to fill with metaphysics then philosophizes himself onto his retreat couch |
Inline | lather, rinse, repeat |
Inline | shlomif: i'm a holidayist |
Inline | lol |
shlomif | Inline: \o/ :D |
shlomif | Inline++ # good joke |
shlomif | Inline: may i tweet it? |
shlomif | we got a bit offtopic though |
shlomif | Inline: "there is no escape from shlomif's philosophical corner!" ;) |
shlomif | https://www.youtube.com/watch?v=9m-kbBamg_U - 'stay there!' |
candide | Title of shlomif's link: Sesame Street: Grover And Herry Explain Here & There - YouTube |
pr-asadi | Hi guys. |
pr-asadi | How can i define a char array with 10 MB size? |
pr-asadi | I do not want use pointer or malloc. |
dave0 | pr-asadi: static char array[10*1024*1024]; |
shlomif | dave0++ |
dave0 | dave1 |
shlomif | 10 MB is peanuts nowadays. |
twkm | still might fail though if the duration is automatic. |
pr-asadi | dave0: How did do static? |
dave0 | pr-asadi: because twkm |
twkm | static duration was required. the static keyword might not be needed, but that depends on context. |
Twix | usually it is not a good idea to put a 10 MB array on the stack. I think usually the stack on Linux is only 8 MB big(might be higher now, not sure what the current value is). So putting it into the static memory section might be good idea :> |
Twix | but why do you not like to use malloc? I usually avoid malloc, too. But its because i usually work in microcontrollers |
pr-asadi | So... fgets function does not give char *array type. |
pr-asadi | does not takes* |
Twix | ? |
pr-asadi | I should use narrow string(char array[length]). |
twkm | pointer into storage, at least n bytes of it where n is what you provide a the second argument. |
twkm | some prefer using allocated storage there, but automatic, static or thread local is fine too. |
pr-asadi | Twix: What do you mean? I am a beginner. |
Twix | that the stack size is limited? Or the static memory thing? |
pr-asadi | twkm: I should read more about the static keyword. |
Twix | there are basically 3 memory sections. Maybe 4 if you take thread local memory into account. The stack, the heap and the static memory |
twkm | indeed, storage duration and the meaning of the qualifiers should be learned. |
twkm | ugh. |
Twix | the static memory gets allocated by the compiler/linker. Its size is known at compile time / before the program has been started. |
* caveman | has quit (Quit: the ##end of the abyss) |
Twix | every thing you declare as static never gets deleted. The memory is allocated due the whole program lifetime. E.g. if you have a static variable in a function, it will keep it content between calls of this function |
pr-asadi | Twix: Thanks man. I did know these things. I should read more. |
Twix | you did already know? :o |
Twix | on microcontrollers its neat to use static memory for everything. If you avoid malloc you can make better predictions about the memory consumption of your program |
Twix | but its more complicated to write a memory efficient program. You need to put a lot of thought how to use these static allocated memory to not waste it |
Twix | On a bigger system i would not recommend this technique and rather simply use malloc to get the buffer you need |
twkm | given char s[n]; or static char s[n]; or char *s = malloc(n); -- which you provide to fgets doesn't matter to fgets. |
pr-asadi | Twix: Sorry. "I did not" is true. |
Twix | :D |
twkm | of course you must provide n (or less than n) as well, not some larger value. |
Twix | i always use INT_MAX. Works every time. But if i only could find the reason for those segmentation faults ... |
Twix | :> |
Twix | oh hi fputs_ o/ |
shlomif | fputs_: hi. sup? |
Posterdati | hi |
Posterdati | is anyone converting fortran77 to c? |
twkm | some have. |
kurahaupo | Posterdati: "is" or "can"? |
Posterdati | is |
Posterdati | I think is the better choice to apply |
kurahaupo | There isn't much Fortran code left, so even people skilled at doing that probably aren't doing it now |
Posterdati | not using f2c |
twkm | some things in c99 were specifically to (app)ease such efforts. |
kurahaupo | Or are you looking for someone to help? |
kurahaupo | or to help you? |
Posterdati | kurahaupo: some applications are still maintained in fortran77 due to its speed for linear algebra computations |
Posterdati | vectors arithmetics is faster |
Posterdati | on f77 |
* shlomif | only wrote FizzBuzz in fortran |
kurahaupo | Posterdati: Vector arithmetic will be faster in whichever languages can use the hardware acceleration in modern CPUs |
Posterdati | well comparing the same algorithm in c and fortran77 the latter always win |