Thread: volatile keyword help!!!!

  1. #1
    Registered User penney's Avatar
    Join Date
    Jan 2003

    volatile keyword help!!!!

    I am trying to be the hero for my company here and so I am hoping that one of you guys will actually be the hero but that I can take the credit . Anyway, I was informed that our company just recently upgraded to the latest version of AIX - I think they went from 4.3 to 5.0. Our C applications that were using shared memory with malloc's no longer work (bad thing to do in the first place if you ask me but I didn't write it - thank God). Anyway I vaguely remember reading something about volatile if you want to do something like this - is that correct or what is volatile for? Is it for ensuring that the compiler won't perform any optimizations on the volatile variable? Do you think this is what we need to use now for the shared memory or how should this problem be fixed?
    Sorry but no code to provide at this point. Lastly, the main program which was defined as int main(void) and has a return(0); in it no longer works but causes the system to crap. Any ideas on all of this stuff would be greatly appreciated. Does main need to now return a larger type because of the 64 bit machine? Maybe return((long)0)?

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Can you be a bit more specific than "no longer work" ? What are the symptoms, what debugging has been done, what makes you think its a shared memory problem? Does it core dump, if so, can you use dbx or gdb to make us of it?

    Moving thread to the linux board, as this is *nix specific.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User penney's Avatar
    Join Date
    Jan 2003

    Thanks anyway

    Unfortunately I am not closely enough involved to find out the absolute specifics of the problem. I just heard through the grapevine and being a C programmer wanted to offer my advice and thoughts. Off the cuff I thought it might be that they needed to now ensure that they use the volatile keyword but like you said I don't have enough info to go on based on what they said. Thanks for your thoughts though.

    I was wondering did any of you have thoughts about the main not working now because of the return. I suppose they mean that it's CORE Dumping but again I don't know for sure.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 07:27 AM
  2. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  3. Virtual Keyword
    By Shal in forum C++ Programming
    Replies: 6
    Last Post: 05-18-2006, 11:37 AM
  4. Volatile Keyword!!
    By maven in forum C Programming
    Replies: 8
    Last Post: 12-06-2005, 12:56 PM
  5. how to search a keyword in C?
    By kreyes in forum C Programming
    Replies: 2
    Last Post: 03-01-2002, 08:22 PM