Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-120121-160161-

What will this C code do?

Name: Anonymous 2012-01-19 8:24

void main(){
int x=1;
printf("%d\n",x=2);
}

Name: Anonymous 2012-01-19 8:37

>>1
return a Void

Thread Over

Name: Anonymous 2012-01-19 8:54

It will print 1 or gently hax your anus.

Name: Anonymous 2012-01-19 8:54

prints out 2 and returns void

Name: Anonymous 2012-01-19 9:20

>>1
main return type not int
9-sqrt(3)/10.0
GTFO
will print 2

Name: Anonymous 2012-01-19 11:13

ONE WORD THE FORCED SEQUENCING OF THE POINT THREAD OVER

Name: Kaz 2012-01-19 12:35

Your void main is a system-specific way of writing the startup function which may or may not work. The C language requires (hosted) implementations to support int main(void) and int main(int, char **). Also, the printf function must be declared before being used. This is because it is variadic. Implicit declarations are not required to be compatible with variadic functions, so this may or may not work.   If you fix these problems, then the program outputs 2 (in a reliable way that should work everywhere). The expression x=2 yields the new value of x. The printf function operates on the value produced by the argument expression, not on the object x. (I.e. the new value of x is stable before the function is called, due to a sequence point that happens before a function call, but that is irrelevant since printf does not know anything about x.)

Name: Anonymous 2012-01-19 12:40

>>7
Oh shit main. Are you the same Kaz whose C expection handling code that got used in wireshark?! Because based on how you write, I'm don't think you're posing as him.

Name: Anonymous 2012-01-19 12:43

>>7
Yeah, I think you are the same person! Wow, I've gone back and forth with you on another programming forum. You're a programming god.

Name: Anonymous 2012-01-19 12:46

>>7

Finally someone sane and logical has come to /prog/. Hopefully you can destroy joblesskodak and frozenvoid for us

Name: Anonymous 2012-01-19 12:49

>>10
>>9
>>8
give him a blowjob then

Name: Anonymous 2012-01-19 12:49

>>10
I would really listen to what this guy has to say because he really is *all that*.

Name: Anonymous 2012-01-19 12:50

>>11
No, but the guy has done more in 2 years that what you will ever accomplish in your entire life.

Name: Anonymous 2012-01-19 13:08

>>13
Are you'
>implying
that he has a future as a comoputer programmer!?
Run little piggy, before /prog/ takes away your future!

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 13:12

>>14
I've talked with kaz on comp.lang.c. Unlike you, this guy is very far from being a mental midget.

Name: Anonymous 2012-01-19 13:16

>>15
Not a mental midget to kodak.
Guy must be the second coming of Dennis Ritchie & McCarthy
>>7
Put actual email in the email field, must be crazy or trolling.

Name: Anonymous 2012-01-19 13:43

easy guide to detecting faggots:
1. utter "sizeof(char) is always 8 on proper architectures"
2. see if they cringe
3. (optionally) if they do, punch them in the groins

Name: Anonymous 2012-01-19 13:45

>>17
Now tell us again why you can't get a programming job.

Name: 17 2012-01-19 13:48

self-fix:
1. utter "((char)1<<8 + (char)1<<7) == 1<<7 on all proper architectures"

also kodak is a faggot

Name: Anonymous 2012-01-19 13:49

>>17
"sizeof(char) is always 8 on proper architectures"
1/10
Yes 1 is a hint.

Name: Anonymous 2012-01-19 13:53

>>19
8-bit is shit.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 13:53

>>20
8 is ambiguous. Man, I tell ya, your written communication is almost as bad as your programming skills. So again, you're stupid. And yet again, you have no possible future as a computer programmer.

Name: Anonymous 2012-01-19 13:56

I bet kodak is the kind of faggot who respects strict aliasing everywhere.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 13:58

>>20
Also, once again, you need to learn how to read. Look at how ANSI/ISO C9899 defines char. Do you see 8 anywhere? Does the standard imply 8? Exactly. Now shut your pie hole you mental midget.

Name: Anonymous 2012-01-19 14:00

>>24
I don't, but on all proper (ie non-shit) architectures it will be 8 bits. Fuck your microcontrollers, faggot.

Name: Anonymous 2012-01-19 14:00

>>24
Me thinks the standard guarantees sizeof(char) is 1, hence you failed to get the hint.
Hugs & kisses.

Name: Anonymous 2012-01-19 14:02

>>23
That kind of reminds me of a firm that I interviewed with right after undergrad school. The managers not only asked me to solve the programming problems, but solve them in such a way that it would have to pass a compiler with all of the warnings enabled.

Name: kodak_galler_programmer !!kCq+A64Losi56ze 2012-01-19 14:04

>>26
It defines it as 1 (byte). Nowhere does it say anything about it being 8 bits. There is a reason for being so subtle. In some respects, it's kind of like how '%' in java isn't modulo. The difference is subtle, but important.

Name: Anonymous 2012-01-19 14:07

>>27

warning: assignment makes pointer from integer without a cast

Yup, silly compiler, I know what I doing! Bend to my will!

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 14:07

>>25
In other words, you expect the shit to only run on your mothers PC. Nice job chief. You're below average.

Name: Anonymous 2012-01-19 14:10

>>28
What he's saying is that sizeof(char) is always 1, which defeats your little "[code]sizeof(char)[/code
 is always 8 on proper architectures" impression.

Name: Anonymous 2012-01-19 14:11

Who is Kaz? What did he do...please fill me in

Name: Anonymous 2012-01-19 14:13

>>32
he fucked yo ass

Name: Anonymous 2012-01-19 14:15

>>25,27
C is not meant to be a general-purpose algorithmic language. People trying to use it as such is the reason why we have so much shit software today and so many security flaws. Just look at GNOME or the Linux kernel. I'm not saying C++ is any better, of course, it just amplifies C's problem by piling layers and layers of shit on top of it.

So please, use C as what it was meant to be; a portable assembly language.

>>25
Enjoy your unreliability and lack of GC. I truly hope you get stuck designing GUIs in C for the rest of your shitty life.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 14:15

>>32
The last post I saw from his on comp.lang.c was the source code to emulating the whole try/catch thing. He went on to say something to the effect that this code eventually made its way into wirehark. I also remember him talking about working on some kind of embedded linux thing.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 14:19

>>34
Just look at GNOME or the Linux kernel.

I smell bullshit. The reason why GNOME is crap is because the homos on that project decided to do an entire code rewrite instead of fixing the existing bugs. This is because, as you probably don't know, it's just far easier to rewrite the crap and "get it right this time".

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-19 14:23

>>36
Here's what's really funny about shit like GNOME. It used to be that part of the code base was stable and secure. Then a new group of wankers came in and just rewrote it. This is because, and I quote the one engineer "The code looks ugly, and besides, I really don't understand what it does".

Name: Anonymous 2012-01-19 14:36

>>25'
>2012
>using 8-bit bytes for obsolete 8-bit character sets

WE UNICODE NOW

Name: Anonymous 2012-01-19 14:45

>>38'
>2012
>using unicode


ANSI master race here, suck my dick mental midget toilet scrubber. You will never amount to anything in your life and I have to keep coming on /prog/ and making fun of you mental midgets to keep my unstable self-esteem from hitting rock bottom.

Name: Anonymous 2012-01-19 17:00

>>36`
>implying
`we'll get it right this time' ever works
atleast they have sexier sugar coated code now, so maybe someone moar capable will be able to understand their bullshit without reading 10000+ pages of homo bs

Name: UTF-8 2012-01-19 19:07

>>38-39
Hi guys, how's it hangin'?

Name: Anonymous 2012-01-19 20:33

Hosted?

// void main(void) is bad because..?

Name: Anonymous 2012-01-20 13:21

>>42

Hosted is a word that refers to C implementations that have a full library (the opposite is "freestanding"). In freestanding C, there may not be a supported startup function called main, and there is no standard in this are. For instance, the Linux kernel does not start with int main(int argc, char **argv). It uses gcc as a freestanding implementation (no standard library either, just pieces of it the kernel provides for itself).  Hosted C implementations can support additional ways for writing the startup function beside the standard one. (E.g. Windows has WinMain).

void main(void) is "bad" because it is a poor tradeoff. you're leaving the standard dialect of C, without getting anything in return (and void is one letter more than int so you don't even save typing). The only exception would be that you need to program some system which for some reason only accepts void main.

void main is cluelessly used by programmers without checking that it is supported  on systems where it isn't actually documented as a valid startup function. it just works by fluke, and usually leaves the program with a garbage termination status, too, if the program stops by running off the end of main instead of calling exit.

Name: Anonymous 2012-01-20 18:35


            :ohmmmhs/`                                                                                                 
         `+mMNy+//+yNmo`                                                                                               
        -dMNo`      .yMh                                                                                               
       -mMd-         `yo   os-                                                                                         
       dMm.              .hMm:                                                                                         
      .MMs              :mMh.                                                                                          
      `mMh`            +NMs`       `os-                                                                                
       -dMh/.        `yMMMy:`     .hMm-                                                                                
        `/hmmdyy+   -dMd-+hmms:` :mMh.   `oo-`                                                                         
           .-/+/.  /NMy`   .+hmmyNNo`   .hMmmdo-`                                                                      
                  sMN+        :NMm:    /mMy..+hmdo-                                                                    
                  :o:        :mMh.   `oNNo`    .+h+                                                                    
                            +NMs`   .hMNNo-`                                                                           
                           sMN/    :mMh-+hmdo.      .:osso/-`                                                          
                           :o-   `+NMs`   .+h+   `/hNNdyyydNdo`                                                        
                                 sMMo           -hMNs-`    -sNd-                                                       
                                 -smmy/.       :NMd-         +N/  `/.                                                  
                                   `:smmy/    .NMd`           .  -mMh                                                  
                                      `:so    oMM-              /NMy`     `                                            
                                              +MM-            `sMN+ ``-/oydy:                                          
                                              `hMm:`         .dMNsoydmNmho/:`                                          
                                                +dNds+/:.   /NMyyMN+:-`                                                
                                                  -+syhs`  oMNo +MN                   `-:                              
                                                         .hMm:  /MM`               /sdNdo.                             
                                                         :hh.   -MM.              hMMo.   `-`                          
                                                                .MM:              ./-    .dMNy/`                       
                                                                `NM+                    /NMy:sNNy/`                    
                                                                 .+-                   sMM+    :sNN-                   
                                                                                     .dMMs`      ``   .:`              
                                                                                    :NMhsmNy/`       /NMNy             
                                                                                   oMMo  `:smm.    `yMNhMN`            
                                                                                 `hMN:      ``    .dMd.dMs             
                                                                                 -hNNo-          /NMy`-MM-             
                                                                                   .+hNdo-     `sMN+  yMd        .+hmy/
                                                                                     `.+hm:   .hMm-  `MM/     .+hNmhMMh`
                                                                                        ``   :mMy`   oMN`  ./hNms:+NMs`
                                                                                             /h+    `mMs./yNmy:``sMN/  
                                                                                                    /MMdmmy/.  .hMd-   
                      .......`         `..         ..     `......`      `..........`                oNNh/.    :mMy`    
                     .mNdhhhdddy/`     +Nm        `NN:    dNmhhhdmdo`   ohhhhhhhdNNy                `..     `oNNo`     
                     .MM/```.-+dMm/    +MM        .MM/    NMs```.:NMy   ```````-hMm-                       `yMm:       
                     .MM:      `sMN:   +MM        .MM/    NMs     yMm         .dMh.                        `oy.        
                     .MM:       `mMh   +MM        .MM/    NMs...-+Nm/        :mMs`                                     
                     .MM:        hMm   +MM        .MM/    NMmddddNMh:`      +NN+                                       
                     .MM:        mMh   +MM        .MM/    NMs....-+NMs    `sMm:                                        
                     .MM:       +MM:   /MM-       /MM-    NMs      sMM`  .dMh.                                         
                     .MM/  ```-sNN+    `dMm:`````/mMy     NMs   ``-mMh  :mMy.```````                                   
                     .NNdhhhhdmdo.      `omNmdhdmNd+`     mNmhhhhdmdo`  mNNddddddddd.                                  
                      -:::::-.`           `-:///:.        -::::::-.     -:::::::::::                                   

Name: Anonymous 2012-01-20 18:39


                                                              omNNm/                  -hNNNh                           
                                                            `yMNmMM+                 :NMmMMN                           
      -h+-`                   -h+-`                        .hMm:hMM+                +NMs:MMN                           
      -mMNmy+-`               -mMNmy+-`                   -mMd. yMM+               sMM+ -MMN                           
       `-+ymMNmy/-`            `-+ymMNmy/-`              :NMh`  yMM+             `yMN/  -MMN                           
           `-+ydNNmy/-             `-+ydNNmy/-          +NMs`   yMM+            .dMm-   -MMN                           
               `-+dMMN-                `-+dMMN-       `sMN+     yMM+           -mMd.    -MMN                           
             `./sdNNds`              `./sdNNds`      `yMM+......hMMo..`       /NMd-.....:MMN..`                        
         `./sdNNdy/.`            `./sdNNdy/.`        :MMMmmmmmmmNMMNmmy       dMMNmmmmmmmMMMmmm-                       
      `/sdNNmy/-`             `/sdNNmy/-`            `/+++++++++dMMy++-       :+++++++++oMMN++/`                       
      :Nmy+-`                 :Nmy+-`                           yMM+                    -MMN                           
      `-`                     `-`                               yNN+                    -NNm                           
                                                                .--`                     ---                           
        :///.          :/:           .//-               `.:+ooo/:.`           :///////////:                            
       `MMMMN/        `MMN`          sMMy             -smNMNNNNNMNd+         -MMMNNNNNNNNNd                            
       `MMNmMM+       `MMN`          sMMh           `sNMNy/-...-/smN.        -MMN.........`                            
       `MMN-mMMo      `MMN`          sMMh          `hMMm-         `-         -MMN`                                     
       `MMN .mMMs`    `MMN`          sMMh          +MMN.                     -MMN`                                     
       `MMN  .dMMy`   `MMN`          sMMh          mMMy                      -MMN:-------`                             
       `MMN   `hMMh`  `MMN`          sMMh         `NMM+                      -MMMNNNNNNNNo                             
       `MMN    `yMMd. `MMN`          sMMh         `NMMo                      -MMN--------`                             
       `MMN      sMMm.`MMN`          sMMh          dMMd                      -MMN`                                     
       `MMN       oMMm-MMN`          sMMh          :MMMo                     -MMN`                                     
       `MMN        +MMNMMN`          sMMh           +MMMh-       .+y.        -MMN`                                     
       `MMN         /MMMMN`          sMMh            -hMMMNdyyyhNMMm.        -MMMyyyyyyyyys                            
       `yhy          -shho           /hh+              ./shdmmdhs+-          `yhhhhhhhhhhhy                            
                                                                                                                       
       `hddddddddhyo:`              /ddo           sdd/          .dddddddddho:              -ohmNNNmhs:                
       `MMMyssssyhmMMNy-            oMMy           dMMo          -MMNsssssymMMm-           sNMNyo++shNM.               
       `MMM.      `-sMMNo           oMMy           dMMo          -MMN      `yMMm          +MMm.      `-                
       `MMM.         :NMMo          oMMy           dMMo          -MMN       /MMN`         oMMm`                        
       `MMM.          oMMN`         oMMy           dMMo          -MMN      -dMM+          .mMMm+-                      
       `MMM.          .MMM:         oMMy           dMMo          -MMMhhhhhmNMd:            .smMMNmy+-                  
       `MMM.          .MMM:         oMMy           dMMo          -MMMhyyyyhdNNmy.            `:ohmMMNd+`               
       `MMM.          :MMM.         oMMy           dMMo          -MMN`     `.yMMm.               `-smMMd.              
       `MMM.         `dMMy          oMMd           mMM/          -MMN        `NMMo                  .NMM+              
       `MMM.        -hMMd.          .NMM+         +MMm`          -MMN        .MMM/        `         `NMM+              
       `MMM:..---:+hNMNs`            /NMNy/-...-/yMMd-           -MMN-....-:omMMy`       `mh+:....-/dMMy`              
       `NMMNNNNNNNNdy+.               .odNMNmmmNNmh+`            -MMMNNNNNNNNdy:          sdNNNmmmNNmh/`               
        -:::::::--.`                    `.:////:-.                -::::::::-.`             `.-////:-.                  
        -::::::::-.              `::::::::-.`                   .-:/++/:-.`                                            
       `NMMNNNNNNNmh+`           /MMMNNNNNMNmy:              .+hmNNmmmmNMNdo-                                          
       `MMM:----:+mMMy           +MMm-----:sNMMo            +mMNh/-....-/hNMNo                                         
       `MMM`      :MMM.          +MMm       oMMM`          sMMm:          /NMMo                                        
       `MMM`      /MMm`          +MMm       +MMN`         :MMM:            +MMM.                                       
       `MMM-...-:sNNd-           +MMm`````-oNMN/          yMMd             `NMM+                                       
       `MMMMNNNNMMMmo-           +MMMmmmmNMMdo.           dMMy              mMMo                                       
       `MMM/:::::/yNMMs`         +MMNooosdMMh:            dMMy              NMM+                                       
       `MMM`       -NMMo         +MMm     /NMM+           sMMm             -MMM-                                       
       `MMM`        dMMy         +MMm      :NMM:          -NMM+           `dMMy                                        
       `MMM`      `/MMM:         +MMm       +MMN.          +MMMs.       `:dMMh`                                        
       `MMMssssssymMMm/          +MMm        yMMd`          :dMMNhso++oymMMm+                                          
       `hddddddddhyo-            :ddy        `ydd/            -+ydmNNNmdyo:                                            

Name: ‮ tegdim latnem ‭Anonymous 2012-01-20 19:31

>>36-37
While I agree that the current GNOME developers may be likened to a bunch of smoking cigarettes, my statement is stronger; I am stating that the root of the problem is the language itself. You don't see people writing HTML engines in assembly -- "of course not, that would be error prone (therefore possibly introducing security flaws) and rather masochistic". Then why do you see people writing such complex things in a language that is merely one thin layer of abstraction over assembly language?

Nay, C was meant to be portable assembly, and it was meant to be used for small programs like bootloaders or parts of OS kernels. And in this context, it's a bit hard to assume that chars don't have a certain size, or to respect strict aliasing given the crazy amount of casts that are to be done.

Oh and don't bother arguing that C is defined in terms of the C abstract machine and therefore has no relationship with assembly. The reason C is so useful is exactly because its popular implementations interface and integrate so well with assembly code and with the underlying machine, thereby yielding very efficient code. A C implementation that would just stick to the letter of the standard and specify nor allow anything else would be quite very pointless. C is not a great language. It's really the compilers that make it worth it.

Name: Anonymous 2012-01-20 20:52

I typed ``Kaz'' into firefox and it opened http://for-sale.yakaz.co.uk/pet-polecats-for-salep

WUT

Name: Anonymous 2012-01-20 21:07

>>47

Check out "Kaz's Underworld". Awesome comic. Check the Movies section too after some of the stills.

Name: Anonymous 2012-01-20 23:53

>>46
It's really the compilers that make it worth it.

Congrats, that goes for every single language.

Name: Anonymous 2012-01-21 0:10

>>46
Please read http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html , C really can't be properly labeled as a "portable assembler."

Name: Anonymous 2012-01-21 1:59

>>49
No, it's not. PHP, Ruby, Python, JS until the browser war.

Name: Anonymous 2012-01-21 3:26

>>50
I was already using -fno-strict-aliasing and -fwrapv. Keeping that in mind, C still is a portable assembler.

Name: Anonymous 2012-01-21 4:09

>>52
U MENA ``GCC still is a portable assembler''

Name: Anonymous 2012-01-21 5:02

>>53
clang and tcc too

Name: Anonymous 2012-01-21 6:53


            :ohmmmhs/`                                                                                                
         `+mMNy+//+yNmo`                                                                                              
        -dMNo`      .yMh                                                                                              
       -mMd-         `yo   os-                                                                                        
       dMm.              .hMm:                                                                                        
      .MMs              :mMh.                                                                                         
      `mMh`            +NMs`       `os-                                                                               
       -dMh/.        `yMMMy:`     .hMm-                                                                               
        `/hmmdyy+   -dMd-+hmms:` :mMh.   `oo-`                                                                        
           .-/+/.  /NMy`   .+hmmyNNo`   .hMmmdo-`                                                                     
                  sMN+        :NMm:    /mMy..+hmdo-                                                                   
                  :o:        :mMh.   `oNNo`    .+h+                                                                   
                            +NMs`   .hMNNo-`                                                                          
                           sMN/    :mMh-+hmdo.      .:osso/-`                                                         
                           :o-   `+NMs`   .+h+   `/hNNdyyydNdo`                                                       
                                 sMMo           -hMNs-`    -sNd-                                                      
                                 -smmy/.       :NMd-         +N/  `/.                                                 
                                   `:smmy/    .NMd`           .  -mMh                                                 
                                      `:so    oMM-              /NMy`     `                                           
                                              +MM-            `sMN+ ``-/oydy:                                         
                                              `hMm:`         .dMNsoydmNmho/:`                                         
                                                +dNds+/:.   /NMyyMN+:-`                                               
                                                  -+syhs`  oMNo +MN                   `-:                             
                                                         .hMm:  /MM`               /sdNdo.                            
                                                         :hh.   -MM.              hMMo.   `-`                         
                                                                .MM:              ./-    .dMNy/`                      
                                                                `NM+                    /NMy:sNNy/`                   
                                                                 .+-                   sMM+    :sNN-                  
                                                                                     .dMMs`      ``   .:`             
                                                                                    :NMhsmNy/`       /NMNy            
                                                                                   oMMo  `:smm.    `yMNhMN`           
                                                                                 `hMN:      ``    .dMd.dMs            
                                                                                 -hNNo-          /NMy`-MM-            
                                                                                   .+hNdo-     `sMN+  yMd        .+hmy/
                                                                                     `.+hm:   .hMm-  `MM/     .+hNmhMMh`
                                                                                        ``   :mMy`   oMN`  ./hNms:+NMs`
                                                                                             /h+    `mMs./yNmy:``sMN/ 
                                                                                                    /MMdmmy/.  .hMd-  
                      .......`         `..         ..     `......`      `..........`                oNNh/.    :mMy`   
                     .mNdhhhdddy/`     +Nm        `NN:    dNmhhhdmdo`   ohhhhhhhdNNy                `..     `oNNo`    
                     .MM/```.-+dMm/    +MM        .MM/    NMs```.:NMy   ```````-hMm-                       `yMm:      
                     .MM:      `sMN:   +MM        .MM/    NMs     yMm         .dMh.                        `oy.       
                     .MM:       `mMh   +MM        .MM/    NMs...-+Nm/        :mMs`                                    
                     .MM:        hMm   +MM        .MM/    NMmddddNMh:`      +NN+                                      
                     .MM:        mMh   +MM        .MM/    NMs....-+NMs    `sMm:                                       
                     .MM:       +MM:   /MM-       /MM-    NMs      sMM`  .dMh.                                        
                     .MM/  ```-sNN+    `dMm:`````/mMy     NMs   ``-mMh  :mMy.```````                                  
                     .NNdhhhhdmdo.      `omNmdhdmNd+`     mNmhhhhdmdo`  mNNddddddddd.                                 
                      -:::::-.`           `-:///:.        -::::::-.     -:::::::::::                                   

Name: Anonymous 2012-01-21 7:14

>>50
I don't see your point. The idea is to avoid writing code that leads to undefined behaviour.

Name: Anonymous 2012-01-21 8:26

>>52
Only on x86 without -ffast-math.

Name: Anonymous 2012-01-21 12:22

>>52
Code that requires -fno-strict-aliasing is broken by definition.

Name: Anonymous 2012-01-21 12:30

>>50
Oversized shift amounts and pointer aliasing are undefined behaviour?  Seriously?

Fuck this, I'm writing my shit in assembly;  compilers really can't be trusted nowadays.

Name: Anonymous 2012-01-21 12:37

>>59
I stopped reading the article at

"Use of an uninitialized variable: This is commonly known as source of problems in C programs and there are many tools to catch these: from compiler warnings to static and dynamic analyzers. This improves performance by not requiring that all variables be zero initialized when they come into scope (as Java does). For most scalar variables, this would cause little overhead, but stack arrays and malloc'd memory would incur a memset of the storage, which could be quite costly, particularly since the storage is usually completely overwritten."

This isn't always true. However wrote this crap needs to go relearn the concept of a "translation unit" in ANSI/ISO C.

Name: Anonymous 2012-01-21 12:38

>>60
er... *Whoever wrote this crap*

Name: Anonymous 2012-01-21 12:44

>>60 I think you're missing the point here.

Name: Anonymous 2012-01-21 12:47

>>62
What point? This person clearly doesn't know what they're talking about

Name: Anonymous 2012-01-21 12:49

>>63
So whatever point they are trying to gets trumped by their failure to understand uninitialized variables in C.

Name: Anonymous 2012-01-21 13:12

I can't see anything wrong with it. From the standard:

If the lvalue has an incomplete type and does not have array type, the behavior is undefined.
If the lvalue designates an object of automatic storage duration that could have been declared with the register storage class (never had its address taken), and that object is uninitialized (not declared with an initializer and no assignment to it has been performed prior to use), the behavior is undefined.


1   undefined behavior
    behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this International Standard imposes no requirements

2   NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable results, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message), to terminating a translation or
 execution (with the issuance of a diagnostic message).

3   EXAMPLE
An example of undefined behavior is the behavior on integer overflow.

Please help me.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-21 13:16

>>65
What you cited covers automatic variables. However, what is written in the blog covers more than that.

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-21 13:22

>>66
Now for a brain fart...

CUPS for Linux used to have uninitialized variables variables in parts of their program. However, it wasn't undefined behavior because those variables didn't have automatic duration.

Name: Anonymous 2012-01-21 13:48

>>59 THIS

Name: Anonymous 2012-01-21 14:01

>>40
>>39
>>38
LE ARROW TO THE KNEE XD COSTANZA 2012 IMPLYING /G/ RULZ!
Back to /g/, ``please"!

Name: Anonymous 2012-01-21 14:08

Name: Anonymous 2012-01-21 14:23

>>69 you are using the ``'' incorrectly. Please note, there should be no hint of sarcasm in the negative sense, only, the positive sense.

Name: Anonymous 2012-01-21 14:32

>>69

example: ``faggot''

Name: Anonymous 2012-01-21 15:19

>>59
When would you ever shift an integer by a value greater than or equal to its width? The article didn't say pointer aliasing would lead to undefined behaviour. Just that converting a pointer to an incompatible type and then dereferencing it would.

>>60
You're right, but what do translation units have to do with it?

>>65
As mentioned, it's only undefined for automatic variables. The standard says:
If an object that has static storage duration is not initialized explicitly, then:
— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
— if it is an aggregate, every member is initialized (recursively) according to these rules;
— if it is a union, the first named member is initialized (recursively) according to these rules.

Name: Anonymous 2012-01-21 15:20

god fucking damn it, i fucked up the quote

Name: Anonymous 2012-01-21 15:28

>>73
Because what this person wrote about only applies to variables that have automatic duration. The blog covers more than that. This is an important distinction because there are some widely used Linux programs that have uninitialized variables. However those variables aren't undefined because they don't have automatic duration.

Name: Anonymous 2012-01-21 15:33

>>73
In some cases, what will happen, is that the variable will no longer be a tentative definition once the translation unit is completed. In other words, the uninitialized variable will in fact, become initialized. And depending on what you're trying to achieve, initializing the varible in such a case may in fact hinder the performance of the program.

Name: Anonymous 2012-01-21 15:37

>>73
Also, I shouldn't have given your stupid ass a response since you apparently have me on some kind of filter. Whatever.

Name: Anonymous 2012-01-21 15:41

>>75
Yes, I mentioned that myself...

>>76
I don't think the completion of the translation unit is all that relevant. The important thing is that objects with static duration get default values.

Name: Anonymous 2012-01-21 15:42

>>78
An object doesn't have to have static duration in order to get initialized.

Name: Anonymous 2012-01-21 15:43

>>77
Filter?... what?

Name: Anonymous 2012-01-21 15:43

>>79
It does according to the standard. Point me to something that says otherwise.

Name: Anonymous 2012-01-21 15:44

>>80
I gave a response under a tripcode, however, you totally ignored it.

Name: Anonymous 2012-01-21 15:45

>>82
I clearly didn't, because I said "as mentioned" and was referring to what you said.

Name: Anonymous 2012-01-21 15:45

>>81
What about global variables? Unless it's changed, it used to be that uninitialized global variables would become zero. In fact, a lot of older Linux code relies on this feature.

Name: Anonymous 2012-01-21 15:47

>>84
A global variable is an object that has static duration.

Name: Anonymous 2012-01-21 15:50

>>85
No. The because "static", when used conjunction with a variable, impacts the duration of the variable. Not its scope.

Name: Anonymous 2012-01-21 15:52

>>85
A variable in C has three properties. Scope, duration, and linkage. Using something like 'static' impacts these three basic properties.

Name: Anonymous 2012-01-21 15:52

>>73
As a veteran assembly programmer, I expect this to work as expected:
float foo = xyzzy;
int bar = evil_bit_magic( *(int*)&foo );
foo = *(float*)&bar;


Oh and I expect compilers not to optimize out (x < x+1). If I'm doing the comparison, it's for a reason, I'm not just putting it there for fun. Sure, if you can prove that x will always be smaller than INT_MAX, go ahead and optimize it out, otherwise fuck off. But don't give me undefined behaviour.

Name: Anonymous 2012-01-21 15:55

>>88
I don't think that's undefined behavior because you're not changing the value, but instead, reinterpreting it.

Name: Anonymous 2012-01-21 16:15

>>86
How could something with file scope (i.e. a global variable) not have static duration?

>>88
Strange example. Just cast foo to type int. It's well defined as long as the int can represent the integral part of the float. I don't actually know whether int* to float* and vice-versa is actually undefined. I just know that if they're incompatible in a sense that they're not correctly aligned, the behaviour is undefined. Logic tells me it should be fine (refer to what I first said).

If x is signed, I believe it would be optimized out whether the compiler knows its value or not, because an overflow can occur (undefined behaviour), so either way you're fucked. If it was unsigned, on the other hand, the compiler shouldn't optimize it out.

Name: Anonymous 2012-01-21 16:22

>>90
I was thinking about having a set of uninitialized variables defined in one file, and then having a different C program access these variables. Also, what >>88 isn't that strange because he is reinpreting the value.

Name: Anonymous 2012-01-21 16:24

>>91
And such a move is generally used in your larger programming projects.

Name: Anonymous 2012-01-21 16:25

>>90
because an overflow can occur (undefined behaviour)
All the architectures I work with use 2's complement for signed integers, so normally I would expect it to be very well defined.

Name: Anonymous 2012-01-21 16:26

>>91
A different C program or a different translation unit? I don't know about a different C program (not sure how that would work out), but objects with static duration are initialized before program startup, so the behaviour would be defined.

I said it was strange because he could just cast the float to int.

Name: Anonymous 2012-01-21 16:28

>>93
As long as you use an implementation that specifies how it deals with integer overflow, you should be fine.

Name: Anonymous 2012-01-21 16:37

>>95
There's a big difference between implementation-defined and undefined behaviour.

Name: Anonymous 2012-01-21 16:39

>>93
Completely irrelevant from the language's point of view. Integer overflow causes undefined behaviour, so anything happening is equally valid.

Name: Anonymous 2012-01-21 16:41

>>95
I don't know.  I'm just getting this feeling that there's just too many little things like this, just waiting there to bite me in the allegorical ass.  I'm afraid for the security and correctness of my code.  Sigh.  I don't know, I might actually start working in assembly for my low-level work.  But then I'd have to completely rewrite everything for other architectures.  That's a lot of extra work.  I'm gonna go pop a beer and maybe I'll figure it out eventually.

Name: Anonymous 2012-01-21 16:43

check 'em

Name: Anonymous 2012-01-21 16:47

>>96
I know it would still be undefined behaviour at the end of the day, but in practice, you could get away with it. The best thing to do would be to check whether [code]x[code] is about to overflow.

>>98
Correct me if I'm wrong, but even with assembly you'd still have the same problems. Again, the best thing to do would be to check the value.

Name: Anonymous 2012-01-21 17:14

>>98
You could spend your time sub-optimally unrolling loops and shuffling registers around like a retard or you could let the compiler do a better job for you.

Name: Anonymous 2012-01-21 17:32

>>101
Slow and secure VS Fast and flawed.
I know what I'd pick.

Name: Anonymous 2012-01-21 17:33

alternately you could make a better compiler

Name: Anonymous 2012-01-21 17:35

As a noobish newcomer, I would do this:
#include <stdint.h>
union word {
    float foo;
    int32_t bar;
};
int main() {
    union word a = {1.0};
    a.bar = evil_bit_magic(a.bar);
}


Why programmers have this hacker syndrome, denying stuff like if (x == INT_MAX) {...}? It's standard and much more readable.

Name: Anonymous 2012-01-21 17:38

>>104
union

finish reading K&R

Name: Anonymous 2012-01-21 17:39

>>104
Writing into one member of a union and reading from another invokes undefined behaviour. I know at least GCC's optimizers take advantage of this fact.

Name: Anonymous 2012-01-21 18:06

>>94
I said it was strange because he could just cast the float to int.

You don't understand that the code isn't changing the value. Instead, it is reinterpreting it.

Name: Anonymous 2012-01-21 18:24

>>106
No, I couldn't find evidence. Standard only cites that an union is a structure where the storage of all its members overlap. The other way around may produce undefined behavior, if the value assigned to a.bar isn't a valid float. Also, if a.bar overflows, it's better to write:
union word {
    float foo;
    uint32_t bar;
};

Name: Anonymous 2012-01-21 20:14

>>108
ISO/IEC 9899:1999
Annex J
J.1 Unspecified behaviour
The following are unspecified:
- The value of a union member other than the last one stored into (6.2.6.1).


§6.2.6.1/7:
When a value is stored in a member of an object of union type, the bytes of the object representation that do not correspond to that member but do correspond to other members take unspecified values, but the value of the union object shall not thereby become a trap representation.

Name: Anonymous 2012-01-21 20:58

>>108
>>109
Whelp, ISO/IEC 9899:1999:TC3 seems to have legalized type punning via unions:
§6.5.2.3/3 fn 82:
If the member used to access the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called "type punning"). This might be a trap representation.

Name: Anonymous 2012-01-21 21:54

epic triples xD

Name: Anonymous 2012-01-21 23:59

>>111
If it ain't trips, it's crap.

Name: Anonymous 2012-01-22 0:32

Trips' shit.

Name: Anonymous 2012-01-22 12:17

>>94
A different C program or a different translation unit? I don't know about a different C program (not sure how that would work out), but objects with static duration are initialized before program startup, so the behaviour would be defined.

Informally, in C, variables are named objects. These variables have scope, duration, and linkage. Also, an object is a runtime thing. Ie, it doesn't exist at compile time. Eer....why am I arguing with some faggot that thinks global variables are static?

Why don't you just fucking read the standard and write some code you moron.

Name: Anonymous 2012-01-22 12:21

I declare all my global variables in the data segment because i'm a boss nigger.

check my (postcount % 15) dubs niggas

Name: Anonymous 2012-01-22 12:52

>>114
Are you that same person (kodak_gallery_programmer)? You realize global variables have file scope by definition, right? Since they have file scope, they can't have automatic duration. The object could be a pointer to an object that has allocated duration, but the variable itself would still have static duration.

Name: Anonymous 2012-01-22 13:03

>>116
Again, for the second time, a variable and an object in C aren't the same thing. Which part of this doesn't your monkey ass get?

Name: Anonymous 2012-01-22 13:04

>>116
And again, an object in C is a runtime thing. Now why don't you just shut the fuckup and read the standard instead of giving your own creative interpretation of the language.

Name: Anonymous 2012-01-22 13:25

>>117,118
They refer to the same thing in this context... I don't understand what you're getting at.

Name: Anonymous 2012-01-22 13:29

>>119
No they don't. Why are you trying to argue about something that you clearly don't understand? Anyways, at least in C, it's possible for a variable to not have an associated object with it. Likewise, it's possible to have an unnamed variable.

Name: Anonymous 2012-01-22 13:34

>>120
You mean an uninitialized variable? It would have an indeterminate value, but it would still have been allocated. If by unnamed variable you're referring to unnamed members of a struct or union, again, it would still be allocated somewhere. In the case of a flexible array member, it would have allocated duration.

Name: Anonymous 2012-01-22 13:36

>>119
And more to the point you annoying fucker...

You realize global variables have file scope by definition, right? Since they have file scope, they can't have automatic duration.

I can think of a case where a global variable doesn't have automatic duration. In other words, the variable wouldn't have an object associated with it.

Name: Anonymous 2012-01-22 13:40

>>121
You mean an uninitialized variable? It would have an indeterminate value, but it would still have been allocated.

And what happens if I don't define the variable you annoying shit? Exactly. Now again, I suggest that you actually read a book.

Name: Anonymous 2012-01-22 13:40

>>122
I said they can't have automatic duration. If you don't explicitly initialize a global variable, it's value will be 0, unless of course you only declared the variable, in which case it will just be ignored if you don't provide a definition.

Name: Anonymous 2012-01-22 13:42

>>123
Are you talking about global variables specifically? If you don't define the variable, it is just ignored, as mentioned by my previous post.

Name: Anonymous 2012-01-22 13:44

>>124
unless of course you only declared the variable, in which case it will just be ignored if you don't provide a definition.

Again, that is incorrect you moron.

Name: Anonymous 2012-01-22 13:45

>>125
No, it won't get ignored you idiot. Why don't you just shut the fuck up and write some C code since you clearly don't seem to keen on the whole reading thing.

Name: Anonymous 2012-01-22 13:49

>>126,127
If there's no definition, it can't be allocated. If you try to use that variable, your compiler will spit out an error. Why don't you take your own advice and write some C code?

Name: Anonymous 2012-01-22 13:52

>>128
If there's no definition, it can't be allocated. If you try to use that variable, your compiler will spit out an error.

That's because the compiler isn't ignoring the variable you fucking annoying stupid shit. If the compiler would have in fact ignored the variable, like what you claim, then it wouldn't have spit out an error.

Why don't you take your own advice and write some C code?

I have you annoying stupid shit.

Name: Anonymous 2012-01-22 13:53

>>128
And again, for the third time, you aren't making a clear distinction between the variable and the object. So once again, you're stupid. And once again, you have no possible future as a computer programmer.

Name: Anonymous 2012-01-22 13:58

>>129
It will be ignored. There won't be any trace of it after the program is compiled. However, if you're trying to use it, the compiler will obviously complain. Since you're so fond of the standard:
If an identifier declared with external linkage is used in an expression (other than as part of the operand of a sizeof operator whose result is an integer constant), somewhere in the entire program there shall be exactly one external definition for the identifier; otherwise, there shall be no more than one.

Name: Anonymous 2012-01-22 13:59

>>130
Waah waah waah, that's you crying like a baby.

Name: Anonymous 2012-01-22 14:00

>>128

PROTIP: Do not discuss with Kodak. He suffers from schizophrenia and urinary incontinence, which gives him a rather unpleasant attitude. The assiduous presence of such people is the worst thing which can happen to non-moderated boards.

Name: Anonymous 2012-01-22 14:01

>>131
But having something like

int foo;

isn't an expression you fucking moron.

Name: Anonymous 2012-01-22 14:04

>>131
Also you stupid fucker, in C, a statement, an expression, and an expression-statement are three different thing. Cripes you are one stupid SOB.

Name: Anonymous 2012-01-22 14:05

>>133
Do you care to help the toilet scrubber out?

Name: Anonymous 2012-01-22 14:23

>>134
I can now see why I'm even having to argue with you with something that should be obvious. You can't read. Of course that's not an expression. "Used as an expression" means:

if (foo);

There. I used it as an expression.

Also, int foo; is an external definition, not just a declaration. Just in case you didn't know.

Name: Anonymous 2012-01-22 14:25

>>137
But what you cited related to an expression. Having something like

int foo;

or even

extern int foo;

isn't an expression. So now, let's stay on topic you mental midget.

Name: Anonymous 2012-01-22 14:29

>Also, int foo; is an external definition,

This is an external variable. And again, this variable has scope, duration, and linkage.

Name: Anonymous 2012-01-22 14:44

>>138
No, you misunderstood. It's saying that if the variable is used as an expression, it must be defined. Otherwise, it need not be. However, we're going slightly off-topic. The original argument, that all global variables have static duration, still stands. I don't count variables that have no definition.

>>139
What I'm getting at is that it does have a definition.

Name: Anonymous 2012-01-22 15:05

>>140
something like

int foo;

has a definition.

The original argument, that all global variables have static duration

This is still incorrect you idiot. Of course the only way you would know this is if you would have written some actual C code instead of arguing with me.

Name: Anonymous 2012-01-22 15:09

>>141
Why don't you point me to somewhere in the standard that says otherwise.

Name: Anonymous 2012-01-22 15:15

>>142
Under section 6.2.2

"If the declaration of a file scope identifier for an object or a function contains the storage-class specifier static, the identifiere has internal linkage."

Now you annoying stupid shit, the point is, using static modifies the global variable in such a way that is now has internal linkage. In other words, there passage in no way shape or form implies that global variables have static duration.

Name: Anonymous 2012-01-22 15:17

>>142
The passage says it and my conformant C compiler seems to verify it. The fact that you misunderstood the passage just means that you're a mental midget.

Name: Anonymous 2012-01-22 15:19

>>143
Holy fuck, the storage-class specifier static has nothing to with static duration.

Name: Anonymous 2012-01-22 15:21

>>145
Yes it does. Read the definition of static again you fucking moron.

Name: Anonymous 2012-01-22 15:25

>>146
Better yet, let me cite it for your stupid ass..

Under section 6.2.4

"An object whose identifier is declared with external or internal linkate, or with the storage-class specififer static has static storage duration. Its lifetime is the entire exeuction of the program and its stored value is initialized only once, prior to the program startup."

In other words, 'static storage duration' is a result of using the 'static' keyword you fucking idiot.

Name: Anonymous 2012-01-22 15:25

>>146
An object has a storage duration that determines its lifetime. There are three storage durations: static, automatic, and allocated. An object whose identifier is declared with external or internal linkage, or with the storage-class specifier static has static storage duration. Its lifetime is the entire execution of the program and its stored value is initialized only once, prior to program startup.

I don't know they emphasized that the storage-class specifier static here, but if you use your common sense, a global variable with internal linkage was obviously declared with the static specifier.

Name: Anonymous 2012-01-22 15:28

>>148
Becaue they know more than you.

Name: Anonymous 2012-01-22 15:28

>>147
I don't know why they emphasized that, but how about you read that quotation again. If it has external or internal linkage, it has static duration. so it isn't only if you use the static specifier.

Name: Anonymous 2012-01-22 15:29

>>150
Huh? static storage duration is a result of using the static keyword. What part of this doesn't your retarded ass get?

Name: Anonymous 2012-01-22 15:31

>>150
Because the point is fucking stupid shit that properties of the variable change once you remove the 'static' keyword. This is why are emphazing what they are. Holy shit you're stupid.

Name: Anonymous 2012-01-22 15:31

>>151
An object whose identifier is declared with external or internal linkage, or with the storage-class specifier static has static storage duration.

THIS CAN ONLY BE A GLOBAL VARIABLE HURR DURR

Name: Anonymous 2012-01-22 15:34

Actually, if you look at the start of the passage, they clearly state "An object has a storage duration that determines its lifetime"

This is before they talk about 'static'. This implies that a variable, by default, wether it be local or global, doesn't have static storage duration.

Name: Anonymous 2012-01-22 15:36

>>154
No, it implies that static duration isn't the only type of duration in general. However, in the case of global variables, it always has static duration. God damn, just read over what I quoted.

Name: Anonymous 2012-01-22 15:38

>>155
Read the entire passage you fucking idiot. Nowhere does it imply it. And the fact that you think it does just tells me that you are a fucking idiot. Again, the passages doesn't imply it, and again, my compiler seems to verify it.

Name: Anonymous 2012-01-22 15:39

>>155
The 'static' keyword modifies the variable. If there is no 'static', there is no modification. This applies to any variables. Even globals. Again, read it again you fucking moron.

Name: Anonymous 2012-01-22 15:45

>>156
What do you mean your compiler verifies it?

Please tell me you know that static duration and the static specifier are two different things? The latter means that the variable has internal linkage, and is one of the conditions for a variable to have static duration, mutually exclusive. The other is external linkage. Using deduction, it becomes clear that all global variables have static duration, because global variables cannot have no linkage, which is the only other type of linkage.

Now please give your responses a second thought before clicking reply, you inept fuck.

>>157
...

Name: Anonymous 2012-01-22 15:51

>>158
The latter means that the variable has internal linkage, and is one of the conditions for a variable to have static duration, mutually exclusive.

Yes.

The other is external linkage.

Yes

Using deduction, it becomes clear that all global variables have static duration, because global variables cannot have no linkage, which is the only other type of linkage.

No. Global variables can have linkage you moron.

>Now please give your responses a second thought before clicking reply, you inept fuck.

You're the minimum wage toilet scrubber. Not me.

Name: Anonymous 2012-01-22 15:59

>>159
No. Global variables can have linkage you moron.
I said they cannot have no linkage. The only variables with no linkage are those declared at block scope or function prototype scope. That isn't to say that variables with block scope can't have external linkage (they can if you use the extern storage-class specifier). Check out the standard:

The following identifiers have no linkage: an identifier declared to be anything other than an object or a function; an identifier declared to be a function parameter; a block scope identifier for an object declared without the storage-class specifier extern.

Name: Anonymous 2012-01-22 16:03

>>160
I said they cannot have no linkage

That really isn't clear. You might want to work on your grammar there buddy.

The only variables with no linkage are those declared at block scope

Again, that's incorrect. Those variables have to have some kind of linkage, otherwise, if I compile this C program against another C program, I could access those variables in that block.

Name: Anonymous 2012-01-22 16:08

>>161
The type of linkage just happens to be referred to as "no linkage".

What I quoted is from the standard, and you're saying it's wrong.

Name: Anonymous 2012-01-22 16:11

>>162
Now I see why you don't work any kind of engineering job. You clearly can't comprehend what you read. Again, global variables do not have static storage duration. This fact is pretty clear from reading the standard. Why you keep asserting something that the standard clearly doesn't imply goes beyond me.

Name: Anonymous 2012-01-22 16:13

>>163
Can we agree that global variables have either internal linkage or external linkage?

Name: Anonymous 2012-01-22 16:14

>>164
Yes. However, the rest of it I don't agree with because you are just making unfounded assumptions when reading the standard.

Name: Anonymous 2012-01-22 16:16

>>165
Now read this part:
An object whose identifier is declared with external or internal linkage, or with the storage-class specifier static has static storage duration.

No assumptions made at all.

Name: Anonymous 2012-01-22 16:16

>>161
I renig on this response. I was mixing up scope with linkage.

Name: Anonymous 2012-01-22 16:18

>>166
I see an 'or' and not an 'and'. In other words, the latter can be false and the former would still be true.

Name: Anonymous 2012-01-22 16:22

hax anii everyday
anii MUST be haxxed

Name: Anonymous 2012-01-22 16:26

>>168
A variable at block scope with the storage-class specifier static doesn't have internal linkage. That's why it was emphasized, sorry, although it would have been better to say "an object whose identifier is declared with external or with the storage-class specifier static..."

Name: Anonymous 2012-01-22 16:27

"an object whose identifier is declared with external linkage or with the storage-class specifier static..." rather

Name: Anonymous 2012-01-22 16:30

>>170
The topic is about global variables. Not variables at block scope. Now again, try and stay focused you stupid sit.

Name: Anonymous 2012-01-22 16:33

>>172
I'm explaining why it mentions "or with the storage-class specifier static" you moran. I've already said everything I had to say. All that's left is for you to acquire at least a fifth grade reading level.

Name: Anonymous 2012-01-22 16:36

>>173
You're the faggot that is going off topic by talking about unrelated stuff such as variables at block scope. Also,

I've already said everything I had to say. All that's left is for you to acquire at least a fifth grade reading level.

You still haven't explained how having variables at block scope level supports 'global variables have static duration'.

Name: Anonymous 2012-01-22 16:39

>>174
I'm saying if a variable at block scope is declared with specifier static, it has static duration, but not internal linkage. That's why it was mentioned. The fact that variables with external or internal linkage have static duration already supports my claim. I swear if I have to repeat the same thing one more time...

Name: Anonymous 2012-01-22 16:41

>>175
That only applies to variables at block scope. There are other variables. Namely global ones.

Name: Anonymous 2012-01-22 16:42

>>175
And again, you're making the assumption that variables at block scope apply to global variables.

Name: Anonymous 2012-01-22 18:14

C is too complex, error-prone and bloated with undefined behaviour.

Code in assembly instead!

How should I divide my assembly files into modules? Should I use headers with macros and structure definitions (nasm supports both) or should I concatenate everything in one single file?  I'll go experiment and see if the linker (GNU ld) is smart enough to DWIM when I use extern and global. by the way I'm coding a toy OS in assembly, no dynamic module loading, monolithic.

Name: Anonymous 2012-01-22 18:41

Name: Anonymous 2012-01-22 21:40

A fatal error occured!

You didn't write a post?!

Powered by Shiichan 3955 + 4chan 20080608.

Name: Anonymous 2012-01-22 23:10

>>180
Yes I did, [spoiler]friend[/friend]

Name: Anonymous 2012-01-22 23:56

>>181
BBcode [spoiler]failure[/failure].

Name: Anonymous 2012-01-23 1:00

>>182
[spoiler]lol[/lol][/b][/u][/(defun dicks x y (format("uheruehruher"))]

Name: Anonymous 2012-01-23 4:08

>>176,177
you're such a fucking retard

Name: Anonymous 2012-01-23 11:49

>>178
Concatenate them together? Jeez.

Name: Anonymous 2012-01-23 15:32

>>185
Oh. Right. I feel a bit like an idiot now.

Name: Anonymous 2012-01-23 16:18

>>188
nice dubs bro

Name: Anonymous 2012-01-23 16:27

>>187
fuck off and die faggot

Name: Anonymous 2012-01-23 17:05

>>188
nice dubs

Name: Anonymous 2012-01-23 22:18

>>185
Are you sure this is a good idea? Won't macros and symbols collide?

Name: Sensei 2012-01-24 2:03

Praimu-no bango desu, yo!

191 GET

$ factor 191
191: 191

Name: Sensei 2012-01-24 2:05

$ factor 192
192: 2 2 2 2 2 2 3

2^3 * 2^3 + 2^3 * 2^3 + 2^3 * 2^3

GET

Name: Sensei 2012-01-24 2:07

Mo hitotsu!

$ factor 193
193: 193

GET!

Name: Geechan 2012-01-24 2:09

2 * 97 ha, anmari omoshiroku nain desu yo.

Nee, Sensei ...

Puraimu ja nai toka, dabsu mo nai ...

Aaaa ... nemui! Neru yo. Mata ashita ...

Don't change these.
Name: Email:
Entire Thread Thread List