05-13-2014
C++ - 'try, throw, catch' compare to regular C-style 'if' - advantages?
(I have long gap to communicate with C++ and do not recall if I have used 'try-catch' at all; so, looking for advice...)
I am trying to understand what the benefits of using that C++ error handling style compare to regular C-style 'if-then'?
Still in the try{} block need to do some 'if()' to be in error condition and 'thtow()' it;
Still need to have separate block to act on defined error condition - so, the same as in block of 'if (error) {.... }'
Only additional funny syntax, blocks and lines of code...
Am I do not understand something or just do not see some benefits?
What the advantage?
Can anybody tell me that in short?
I would accept any: processing timing/simplifying; readability; source organizing; documenting; modularity, .... what else?
I do not see any!
Could you advise some?
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello
to help me with my studying of unix/linux outside of work I was thinking of installing Linux at home aswell as using Windows XP.
Im pretty new to Linux and Unix, could someone tell me the possible benifits or even negatives of running Linux at home as an opperating system as opposed to... (2 Replies)
Discussion started by: Loaded Gun
2 Replies
2. UNIX for Dummies Questions & Answers
What are the advantages of putting users into groups? I understand that in a corporate environment, you should create a group for each department. ie: putting finance employees into a finance group.
But are there any system advantages for doing that? How would it make it easier on the system... (3 Replies)
Discussion started by: kurtmc
3 Replies
3. Shell Programming and Scripting
What is the advantages of Perl in Unix environnement.
Is it for scripts ? Text manipulation ?
Have you a Concrete exemple of perl utilisation.
Thanks you (3 Replies)
Discussion started by: simquest
3 Replies
4. Shell Programming and Scripting
is it possible? if so, how?
i want to check a variable whether is it a number or letter in an if-else statement (6 Replies)
Discussion started by: finalight
6 Replies
5. Shell Programming and Scripting
Hi,
I have this script:
awk -v va=45 '$0~va{print}' flo2
That returns: "4526745 1234 " (this is the only line of the file "flo2".
However, I would like to get "va" to match the begining of the line, so that is "va" is different than 45 (eg. 67, 12 ...) I would not have any output. That... (3 Replies)
Discussion started by: jolecanard
3 Replies
6. Shell Programming and Scripting
Hi,
I need to compare file names in a folder with several strings(which are in regular expression format):
For example:
there is a file "objectMyHistoryBook" and there are several strings to compare this file name with:
objectMyMaths*, objectMyEnglish*, objectMyHistory*,... (2 Replies)
Discussion started by: Lucifer_123
2 Replies
7. UNIX for Dummies Questions & Answers
What are some advantage's of Unix (3 Replies)
Discussion started by: alvin2132
3 Replies
8. UNIX for Dummies Questions & Answers
Readers,
Reading a previous post about comparing files using awk ('awk-compare-2-columns-2-files-output-whole-line', https://www.unix.com/shell-programming-scripting/168432-awk-compare-2-columns-2-files-output-whole-line.html), it is possible to adjust this, so that regular expression can be used... (8 Replies)
Discussion started by: linuxr
8 Replies
LEARN ABOUT OPENSOLARIS
strategy
strategy(9E) Driver Entry Points strategy(9E)
NAME
strategy - perform block I/O
SYNOPSIS
#include <sys/types.h>
#include <sys/buf.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
int prefixstrategy(struct buf *bp);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI). This entry point is required for block devices.
PARAMETERS
bp Pointer to the buf(9S) structure.
DESCRIPTION
The strategy() routine is called indirectly (through cb_ops(9S)) by the kernel to read and write blocks of data on the block device. strat-
egy() may also be called directly or indirectly to support the raw character interface of a block device (read(9E), write(9E) and
ioctl(9E)). The strategy() routine's responsibility is to set up and initiate the transfer.
In general, strategy() should not block. It can, however, perform a kmem_cache_create(9F) with both the KM_PUSHPAGE and KM_SLEEP flags set,
which might block, without causing deadlock in low memory situations.
RETURN VALUES
The strategy() function must return 0. On an error condition, it should call bioerror(9F) to set b_flags to the proper error code, and call
biodone(9F). Note that a partial transfer is not considered to be an error.
SEE ALSO
ioctl(9E), read(9E), write(9E), biodone(9F), bioerror(9F), buf(9S), cb_ops(9S), kmem_cache_create(9F)
Writing Device Drivers
SunOS 5.11 6 Nov 2003 strategy(9E)