Sponsored Content
Top Forums Programming A trivial XOR doubt in a program Post 302247330 by jim mcnamara on Wednesday 15th of October 2008 12:05:00 PM
Old 10-15-2008
The short answer - it is an undefined operation. Means that the C standard regards this as garbage, and your compiler was polite enough to produce spaces.
The reason: there are no sequence points in the line between important steps.

A ; character creates a sequence point. So the first version works. This means the compiler can do any of those calculations in any order...

By the way, that 'swap' algorithm in general is a bad idea; it has unsafe properties. You should use a temp variable. It may look cool to you, but that is about it.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

trivial awk question

i posted a reply the other day and needed an answer to this question while i was clarifyiing a few matter.. "how to compare to date variable in string format without having to compare word for word".. my reply was to try to use awk to compare the strings.. I wasn't quite sure if i remembered how... (2 Replies)
Discussion started by: moxxx68
2 Replies

2. Programming

resetting counter using bitwise XOR

Hi ! How to reset a variable to 0 after a reset value, say 10 using bitwise XOR. For example, int cnt=0; if(cnt<10) cnt++; else cnt = 0; How can we achieve this by using XOR only. thanks, (1 Reply)
Discussion started by: mrgubbala
1 Replies

3. Shell Programming and Scripting

xor 2 values in ksh?

i have to xor two variables in ksh. how to do that? tia, DN2 (5 Replies)
Discussion started by: DukeNuke2
5 Replies

4. Shell Programming and Scripting

Doubt in this trivial awk code

Hi, What is the difference in the following two awk one-liners? awk -F, '{s++} END {if (s == 1 && $4 > "09:10:00") {print $2, $4}}' f1 awk -F, '{s++} s == 1 && $4 > "09:10:00" {print $2, $4}' f1 Even though, all the 2nd column values have duplicate records, the first code does not give any... (4 Replies)
Discussion started by: royalibrahim
4 Replies

5. Shell Programming and Scripting

Trivial perl doubt about FILE

Hi, In the following perl code: #!/usr/bin/perl -w if (open(FILE, "< in_file")) { while (<FILE>) { chomp($_); if ($_ =~ /patt$/) { my $f = (split(" ", $_)); print "$f\n"; } } close FILE; } Why changing the "FILE" as... (4 Replies)
Discussion started by: royalibrahim
4 Replies

6. Programming

Trivial doubt about C function pointer

Hi, In the below C code, #include <stdio.h> void print() { printf("Hello\n"); } int main() { void (*f)() = (void (*)()) print; f(); (*f)(); } I wonder, how the syntaxes "f()" and "(*f)()" are treated as same without any error? Is this an improvement or ANSI/ISO... (1 Reply)
Discussion started by: royalibrahim
1 Replies

7. UNIX for Dummies Questions & Answers

XOR between strings

I am aware of truth table for XOR between binary values . Out of curious in would like to know how XOR works between 2 strings which contain alphabets . For example A ^ B How it works internally? Please help me to understand this Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies

8. FAQ Submission Queue

Analysis in bitwise XOR

The purpose of this article is revealing the unrevealed parts of the bitwise XOR. As we aware, the truth table for the XOR operator is : A B A^B 0 0 0 0 1 1 1 0 1 1 1 0 For example , 1^2 will be calculated as given below: First the operands... (1 Reply)
Discussion started by: pandeesh
1 Replies

9. UNIX for Dummies Questions & Answers

XOR two strings

hi, i am new to shell programming, can u please tell me how to perform XOr operation of two strings. i tried to do xor using ^symbol but this doesnt work. help me with this Thanks (12 Replies)
Discussion started by: anil_uvce
12 Replies
uil(user cmd)															     uil(user cmd)

NAME
uil -- The user interface language compiler SYNOPSIS
uil [options ] [file] DESCRIPTION
The uil command invokes the UIL compiler. The User Interface Language (UIL) is a specification language for describing the initial state of a user interface for a Motif application. The specification describes the objects (menus, dialog boxes, labels, push buttons, and so on) used in the interface and specifies the routines to be called when the interface changes state as a result of user interaction. file Specifies the file to be compiled through the UIL compiler. options Specifies one or more of the following options: -Ipathname This option causes the compiler to look for include files in the directory specified if the include files have not been found in the paths that already were searched. Specify this option followed by a pathname, with no intervening spaces. -m Machine code is listed. This directs the compiler to place in the listing file a description of the records that it added to the User Interface Database (UID). This helps you isolate errors. The default is no machine code. -o file Directs the compiler to produce a UID. By default, UIL creates a UID with the name a.uid. The file specifies the filename for the UID. No UID is produced if the compiler issues any diagnostics categorized as error or severe. UIDs are portable only across same-size machine architectures. -s Directs the compiler to set the locale before compiling any files. The locale is set in an implementation-dependent manner. On ANSI C-based systems, the locale is usually set by calling setlocale(LC_ALL, ""). If this option is not specified, the compiler does not set the locale. -v file Directs the compiler to generate a listing. The file specifies the filename for the listing. If the -v option is not present, no listing is generated by the compiler. The default is no listing. -w Specifies that the compiler suppress all warning and informational messages. If this option is not present, all mes- sages are generated, regardless of the severity. -wmd file Specifies a binary widget meta-language description file to be used in place of the default WML description. RELATED INFORMATION
X(1) and Uil(3). uil(user cmd)
All times are GMT -4. The time now is 05:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy