Sponsored Content
Top Forums Programming Representing INFINITY in C language???? Post 302600224 by fpmurphy on Monday 20th of February 2012 12:00:45 PM
Old 02-20-2012
Better wait, even GCC only supports parts of C11!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

A different language to me!

Hi all, I'm glad there's a section called UNIX for dummies on this forum cause when it comes to UNIX, I am certainly a dummie. I honestly don't have a clue about 98% of the UNIX commands out there so forgive me if this is a really stupid question. I'm trying to set up a MySQL server on my Mac... (7 Replies)
Discussion started by: kguenther
7 Replies

2. Programming

c language

is there any difference between "char*" and "char *" (1 Reply)
Discussion started by: amol munde
1 Replies

3. Programming

which language will be the best

Hello, Ive got to amke a script to calculate how many emails are in the servers mailbox, how many times each IP address appears in the mailbox and to search for keywords, tehn produce the results in HTML report. The thing is I dont know where to start and what the best language to use would be. ... (4 Replies)
Discussion started by: clueless
4 Replies

4. UNIX for Dummies Questions & Answers

What language is this?

Hi, Just got handed this script set def = HLA_DR.pockets set data = DRB1_1501.dat foreach a ( 'cat $data | args 3 |sort -u' ) cat $def | xC | grep -v $a > $$.def cat $data | grep $a | args 1,2 > $a.dat set pseudo = `cat MHCDR_pseudo.dat | grep HLA | grep $a | args 2`... (8 Replies)
Discussion started by: lost
8 Replies

5. Shell Programming and Scripting

Representing dir path for copy through env variable

Hello , i am on linux, and im trying to figure out why my cp command cant copy one file. I am trying to use variable in which i stored path to location where is file i wish to copy. $ echo $ORA_ALERT_LOG /u01/app/oracle/diag/rdbms/ring11/ring11/trace $ $ $ pwd /home/oracle $ cp -p... (2 Replies)
Discussion started by: tonijel
2 Replies

6. UNIX for Dummies Questions & Answers

sleep infinity

This might be one of the dumbest questions you've got, but please bear with me: I am a UNIX beginner. I had an test today and I was asked the following question: Q. How do you put the terminal into sleep indefinitely? I didn't know the answer, but after I came home, I tried the following... (9 Replies)
Discussion started by: indyxandy
9 Replies

7. Shell Programming and Scripting

File representing the hard disk storage device

I want example of a file representing the hard disk storage device In UNIX ? (6 Replies)
Discussion started by: tamer11007
6 Replies

8. Shell Programming and Scripting

awk Merging multiple files with symbol representing new file

I just tried following ls *.dat|sort -t"_" -k2n,2|while read f1 && read f2; do awk '{print}' $f1 awk FNR==1'{print $1,$2,$3,$4,$5,"*","*","*" }' OFS="\t" $f2 awk '{print}' $f2 donegot following result 18-Dec-1983 11:45:00 AM 18.692 84.672 0 25.4 24 18-Dec-1983 ... (3 Replies)
Discussion started by: Akshay Hegde
3 Replies

9. Programming

C language help URGENT !!!

I'am writing a program in C language and my code is working perfectly i just need to add a search to it ... My code lets users add companies, and then display them on screen... i would like to add a search that allows user to type company name and then displayall its info on the screen !! THANK... (1 Reply)
Discussion started by: aloushi
1 Replies

10. UNIX for Beginners Questions & Answers

Can't pass a variable representing the output of lsb_release to a docker dontainer

I don't know why, but the rendering of my code mucks up the spacing and indentation, despite being correct in the original file. I'm having issues getting the following script to run (specifically the nested script at the end of the docker command near the end of the script; I think I'm not passing... (2 Replies)
Discussion started by: James Ray
2 Replies
ATOMIC_VAR_INIT(3)					   BSD Library Functions Manual 					ATOMIC_VAR_INIT(3)

NAME
ATOMIC_VAR_INIT, atomic_init, atomic_load, atomic_store, atomic_exchange, atomic_compare_exchange_strong, atomic_compare_exchange_weak, atomic_fetch_add, atomic_fetch_and, atomic_fetch_or, atomic_fetch_sub, atomic_fetch_xor, atomic_is_lock_free -- type-generic atomic opera- tions SYNOPSIS
#include <stdatomic.h> _Atomic(T) v = ATOMIC_VAR_INIT(c); void atomic_init(_Atomic(T) *object, T value); T atomic_load(_Atomic(T) *object); T atomic_load_explicit(_Atomic(T) *object, memory_order order); void atomic_store(_Atomic(T) *object, T desired); void atomic_store_explicit(_Atomic(T) *object, T desired, memory_order order); T atomic_exchange(_Atomic(T) *object, T desired); T atomic_exchange_explicit(_Atomic(T) *object, T desired, memory_order order); _Bool atomic_compare_exchange_strong(_Atomic(T) *object, T *expected, T desired); _Bool atomic_compare_exchange_strong_explicit(_Atomic(T) *object, T *expected, T desired, memory_order success, memory_order failure); _Bool atomic_compare_exchange_weak(_Atomic(T) *object, T *expected, T desired); _Bool atomic_compare_exchange_weak_explicit(_Atomic(T) *object, T *expected, T desired, memory_order success, memory_order failure); T atomic_fetch_add(_Atomic(T) *object, T operand); T atomic_fetch_add_explicit(_Atomic(T) *object, T operand, memory_order order); T atomic_fetch_and(_Atomic(T) *object, T operand); T atomic_fetch_and_explicit(_Atomic(T) *object, T operand, memory_order order); T atomic_fetch_or(_Atomic(T) *object, T operand); T atomic_fetch_or_explicit(_Atomic(T) *object, T operand, memory_order order); T atomic_fetch_sub(_Atomic(T) *object, T operand); T atomic_fetch_sub_explicit(_Atomic(T) *object, T operand, memory_order order); T atomic_fetch_xor(_Atomic(T) *object, T operand); T atomic_fetch_xor_explicit(_Atomic(T) *object, T operand, memory_order order); _Bool atomic_is_lock_free(const _Atomic(T) *object); DESCRIPTION
The header <stdatomic.h> provides type-generic macros for atomic operations. Atomic operations can be used by multithreaded programs to pro- vide shared variables between threads that in most cases may be modified without acquiring locks. Atomic variables are declared using the _Atomic() type specifier. These variables are not type-compatible with their non-atomic counter- parts. Depending on the compiler used, atomic variables may be opaque and can therefore only be influenced using the macros described. The atomic_init() macro initializes the atomic variable object with a value. Atomic variables can be initialized while being declared using ATOMIC_VAR_INIT(). The atomic_load() macro returns the value of atomic variable object. The atomic_store() macro sets the atomic variable object to its desired value. The atomic_exchange() macro combines the behaviour of atomic_load() and atomic_store(). It sets the atomic variable object to its desired value and returns the original contents of the atomic variable. The atomic_compare_exchange_strong() macro stores a desired value into atomic variable object, only if the atomic variable is equal to its expected value. Upon success, the macro returns true. Upon failure, the desired value is overwritten with the value of the atomic variable and false is returned. The atomic_compare_exchange_weak() macro is identical to atomic_compare_exchange_strong(), but is allowed to fail even if atomic variable object is equal to its expected value. The atomic_fetch_add() macro adds the value operand to atomic variable object and returns the original contents of the atomic variable. The atomic_fetch_and() macro applies the and operator to atomic variable object and operand and stores the value into object, while returning the original contents of the atomic variable. The atomic_fetch_or() macro applies the or operator to atomic variable object and operand and stores the value into object, while returning the original contents of the atomic variable. The atomic_fetch_sub() macro subtracts the value operand from atomic variable object and returns the original contents of the atomic vari- able. The atomic_fetch_xor() macro applies the xor operator to atomic variable object and operand and stores the value into object, while returning the original contents of the atomic variable. The atomic_is_lock_free() macro returns whether atomic variable object uses locks when using atomic operations. BARRIERS
The atomic operations described previously are implemented in such a way that they disallow both the compiler and the executing processor to re-order any nearby memory operations across the atomic operation. In certain cases this behaviour may cause suboptimal performance. To mitigate this, every atomic operation has an _explicit() version that allows the re-ordering to be configured. The order parameter of these _explicit() macros can have one of the following values. memory_order_relaxed No operation orders memory. memory_order_consume Perform consume operation. memory_order_acquire Acquire fence. memory_order_release Release fence. memory_order_acq_rel Acquire and release fence. memory_order_seq_cst Sequentially consistent acquire and release fence. The previously described macros are identical to the _explicit() macros, when order is memory_order_seq_cst. COMPILER SUPPORT
These atomic operations are typically implemented by the compiler, as they must be implemented type-generically and must often use special hardware instructions. As this interface has not been adopted by most compilers yet, the <stdatomic.h> header implements these macros on top of existing compiler intrinsics to provide forward compatibility. This means that certain aspects of the interface, such as support for different barrier types may simply be ignored. When using GCC, all atomic operations are executed as if they are using memory_order_seq_cst. Instead of using the atomic operations provided by this interface, ISO/IEC 9899:2011 (``ISO C11'') allows the atomic variables to be modified directly using built-in language operators. This behaviour cannot be emulated for older compilers. To prevent unintended non-atomic access to these variables, this header file places the atomic variable in a structure when using an older compiler. When using GCC on architectures on which it lacks support for built-in atomic intrinsics, these macros may emit function calls to fallback routines. These fallback routines are only implemented for 32-bits and 64-bits datatypes, if supported by the CPU. SEE ALSO
pthread(3), atomic(9) STANDARDS
These macros attempt to conform to ISO/IEC 9899:2011 (``ISO C11''). HISTORY
These macros appeared in FreeBSD 10.0. AUTHORS
Ed Schouten <ed@FreeBSD.org> David Chisnall <theraven@FreeBSD.org> BSD
December 27, 2011 BSD
All times are GMT -4. The time now is 02:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy