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
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
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
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
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
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
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
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
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
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
LEARN ABOUT CENTOS
config.guess
CONFIG.GUESS(1) User Commands CONFIG.GUESS(1)
NAME
config.guess - guess the build system triplet
SYNOPSIS
config.guess [OPTION]
DESCRIPTION
The GNU build system distinguishes three types of machines, the `build' machine on which the compilers are run, the `host' machine on which
the package being built will run, and, exclusively when you build a compiler, assembler etc., the `target' machine, for which the compiler
being built will produce code.
This script will guess the type of the `build' machine.
Output the configuration name of the system `config.guess' is run on.
Operation modes:
-h, --help
print this help, then exit
-t, --time-stamp
print date of last modification, then exit
-v, --version
print version number, then exit
ENVIRONMENT VARIABLES
config.guess might need to compile and run C code, hence it needs a compiler for the `build' machine: use the environment variable
`CC_FOR_BUILD' to specify the compiler for the build machine. If `CC_FOR_BUILD' is not specified, `CC' will be used. Be sure to specify
`CC_FOR_BUILD' is `CC' is a cross-compiler to the `host' machine.
CC_FOR_BUILD a native C compiler, defaults to `cc'
CC a native C compiler, the previous variable is preferred
REPORTING BUGS
Report bugs and patches to <config-patches@gnu.org>.
Originally written by Per Bothner.
Copyright 1992-2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
autoconf(1), automake(1), autoreconf(1), autoupdate(1), autoheader(1), autoscan(1), config.guess(1), config.sub(1), ifnames(1), libtool(1).
GNU Autoconf 2.69 August 2017 CONFIG.GUESS(1)