Sponsored Content
The Lounge What is on Your Mind? Programming languages polyglots: how many languages you know? Post 302225359 by redoubtable on Friday 15th of August 2008 08:35:50 AM
Old 08-15-2008
I see! So in very simple terms, the letter does not criticize goto by itself. It criticizes programmers that used to over use goto on their programs because that could lead to a less structured and harder to maintain program. Although I can agree with that, I often see people criticizing goto even if it's only used in a structured basis like packing all errors and returns in the end portion of a function:
Code:
int
whatever()
{
        int error;

        do_stuff();
        keep_doing_stuff();
        if (!this_is_right())
        {
                error = EINVAL;
                goto err;
        }
        bla();
        if (this_is_wrong())
        {
                error = EPERM;
                goto err;
        }
        while (...)
        {
                stuff();
                if (stuff2())
                {
                        error = EFAULT;
                        goto err;
                }
        }
        ...
err:
        do_this();
        do_that();
        do_whatever();
        return -error;
}

 

8 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Shell scripting & programming languages

If I want to do high-end 3d animation, what skell scripting languages, and programming languages shoul I learn? If you know any good resources for learning these languages they would be appreciated. (1 Reply)
Discussion started by: aloysius1001
1 Replies

2. UNIX for Advanced & Expert Users

Operating System and Programming languages

I'm trying to create an operating system. Just as a small hobby, it will not be anything big I am trying to get some practice. Does anyone reccomend a certain programming language because I dont know which one to use. Any help please? (2 Replies)
Discussion started by: jacx2
2 Replies

3. UNIX for Dummies Questions & Answers

Programming/Scripting Languages To Learn

Which languages would, in the long run, be best to learn on a UNIX environment for kernel work, every day programs, and overall UNIX programming? I've been learning C for over a year now (which I'm pretty confident with) and decided I want to look into some other languages. I'll mainly be... (1 Reply)
Discussion started by: tjinr
1 Replies

4. Shell Programming and Scripting

output in different languages

hello, i have to change a lot of shell scripts for one reason : the output in a script should be done in different languages. for example: echo "this is a test" and "this is a test" should be printed out in language for an example: german,italian and so. i saw a tool "gettext" ,... (2 Replies)
Discussion started by: bora99
2 Replies

5. Shell Programming and Scripting

bash and languages

Hi everyone, First of all, i dont know what id do without this forum its been such a great help:) so a big thankyou to all, anyway i have a simple question, if i wrote a scrpt in english would it work on another machine with a different language, or do i have to put something in the script to say... (9 Replies)
Discussion started by: dave123
9 Replies

6. UNIX for Advanced & Expert Users

How to export/link Control_m with another programming languages

Hello All. Everyday at work I have to fill a big .xls spreadsheet with process chains start and end time information. The thing is that it takes too long and a lot of boring work. :( I was wondering if I could link this with a tool in java that would export this information into a .xls... (1 Reply)
Discussion started by: pingosa
1 Replies

7. Web Development

What Web Development languages should i learn?

I am learning Web Development, so far i am learning html,xhtml, css, java script.... What I want to know is what other Web Development languages should i learn? (1 Reply)
Discussion started by: Anna Hussie
1 Replies

8. What is on Your Mind?

How can I learn computer programming languages on my own?

I would love the idea to develop games. How can I teach myself computer programming? What programs or software must I use? I have the new iMac? (5 Replies)
Discussion started by: Anna Hussie
5 Replies
Perl::Critic::Policy::ControlStructures::ProhibitUnreachUserCContributed Perl DPerl::Critic::Policy::ControlStructures::ProhibitUnreachableCode(3)

NAME
Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode - Don't write code after an unconditional "die, exit, or next". AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
This policy prohibits code following a statement which unconditionally alters the program flow. This includes calls to "exit", "die", "return", "next", "last" and "goto". Due to common usage, "croak" and "confess" from Carp are also included. Code is reachable if any of the following conditions are true: o Flow-altering statement has a conditional attached to it o Statement is on the right side of an operator "&&", "||", "//", "and", "or", or "err". o Code is prefixed with a label (can potentially be reached via "goto") o Code is a subroutine EXAMPLES
# not ok exit; print "123 "; # ok exit if !$xyz; print "123 "; # not ok for ( 1 .. 10 ) { next; print 1; } # ok for ( 1 .. 10 ) { next if $_ == 5; print 1; } # not ok sub foo { my $bar = shift; return; print 1; } # ok sub foo { my $bar = shift; return if $bar->baz(); print 1; } # not ok die; print "123 "; # ok die; LABEL: print "123 "; # not ok croak; do_something(); # ok croak; sub do_something {} CONFIGURATION
This Policy is not configurable except for the standard options. SEE ALSO
Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls AUTHOR
Peter Guzis <pguzis@cpan.org> COPYRIGHT
Copyright (c) 2006-2011 Peter Guzis. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.16.3 2014-06-09 Perl::Critic::Policy::ControlStructures::ProhibitUnreachableCode(3)
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy