LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-04-2010, 06:38 PM   #1
DoNotknow
LQ Newbie
 
Registered: Feb 2010
Distribution: CentOS RedHat
Posts: 3

Rep: Reputation: 0
Question Semaphore used without initializing


Hi

I am using semaphore.h
I declared a variable of type sem_t.
I am able to use the variable without even calling sem_init or sem_open, and it is working properly.
Can somebody explain to me if the variable is automatically assigned some value?
Also would I run into any trouble doing so?

Last edited by DoNotknow; 11-04-2010 at 07:25 PM.
 
Old 11-05-2010, 05:05 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
It is assigned the value there was in the memory previously. So, normally you can't predict it. Sometimes that may work, but at some point you'll very likely start getting errors/strange behaviour.
 
  


Reply

Tags
default, initialize, semaphore



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Semaphore atulkatrajkar Linux - Newbie 4 10-12-2010 12:56 PM
Semaphore vs Signal scanner Linux - General 4 11-18-2006 01:05 PM
Semaphore tzzdvd Programming 1 05-24-2005 09:23 PM
semaphore beginner_84 Programming 5 08-25-2004 06:54 PM
about semaphore dummyagain Programming 1 11-11-2003 11:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration