• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 01:11
CEST 07:11
KST 14:11
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro8 Preview Pt2: Progenitors4Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event10Code S Season 1 (2026) - RO12 Results12026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Code S Season 1 (2026) - RO12 Results Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid
Tourneys
StarCraft Evolution League (SC Evo Biweekly) $1,400 SEL Season 3 Ladder Invitational RSL Revival: Season 5 - Qualifiers and Main Event GSL Code S Season 1 (2026) SC2 INu's Battles#15 <BO.9 2Matches>
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 524 Death and Taxes The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base
Brood War
General
[ASL21] Ro8 Preview Pt2: Progenitors Why there arent any 256x256 pro maps? BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion
Tourneys
[ASL21] Ro8 Day 3 [ASL21] Ro8 Day 2 [Megathread] Daily Proleagues Escore Tournament StarCraft Season 2
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Dawn of War IV Stormgate/Frost Giant Megathread Nintendo Switch Thread Daigo vs Menard Best of 10 Diablo IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Can Diabetes Be Reversed or Cured Permanently? US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion McBoner: A hockey love story
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1766 users

The Big Programming Thread - Page 545

Forum Index > General Forum
Post a Reply
Prev 1 543 544 545 546 547 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
zzdd
Profile Joined December 2010
United States484 Posts
Last Edited: 2014-11-10 22:42:32
November 10 2014 22:42 GMT
#10881
On November 11 2014 07:14 Cynry wrote:+ Show Spoiler +

relevant code in the .c
int             get_next_line(int const fd, char **line)
{
int ret;
static t_list *files;
t_list *cursor;
t_file *new_file;

ret = 0;
if (files)
{
cursor = files;
while (cursor && cursor->content
&& ((t_file *)cursor->content)->fd != fd)
cursor = cursor->next;
if (cursor->content && ((t_file *)cursor->content)->fd == fd)
ret = ft_read_file(fd, cursor->content, line);
}
else
{
if (!(files = (t_list *)ft_memalloc(sizeof(*files))))
return (-1);
if (!(new_file = (t_file *)ft_memalloc(sizeof(*new_file))))
return (-1);
cursor = ft_lstnew(new_file, sizeof(*new_file));
((t_file *)cursor->content)->fd = fd;
((t_file *)cursor->content)->left_over = 0;
ft_lstadd(&files, cursor);
ret = ft_read_file(fd, cursor->content, line);
}
return (ret);
}

in the .h
#ifndef GET_NEXT_LINE_H
# define GET_NEXT_LINE_H

# define BUFF_SIZE 32
# define EOF "\n"

#include <string.h>

typedef struct s_list
{
void *content;
size_t content_size;
struct s_list *next;
} t_list;

typedef struct s_file
{
int fd;
char *left_over;
} t_file;

The segfault happens with the second call to get_next_line, when if (files) is checked and the program tries to access cursor->content->fd.

files is never set to anything?
Cynry
Profile Blog Joined August 2010
810 Posts
Last Edited: 2014-11-10 23:09:04
November 10 2014 22:59 GMT
#10882
You got me closer and some more errors to corret :D Thanks !

Edit : and after 5 more minutes of debugging I got it working, merci beaucoup !
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
November 10 2014 23:03 GMT
#10883
On November 11 2014 07:42 zzdd wrote:
Show nested quote +
On November 11 2014 07:14 Cynry wrote:+ Show Spoiler +

relevant code in the .c
int             get_next_line(int const fd, char **line)
{
int ret;
static t_list *files;
t_list *cursor;
t_file *new_file;

ret = 0;
if (files)
{
cursor = files;
while (cursor && cursor->content
&& ((t_file *)cursor->content)->fd != fd)
cursor = cursor->next;
if (cursor->content && ((t_file *)cursor->content)->fd == fd)
ret = ft_read_file(fd, cursor->content, line);
}
else
{
if (!(files = (t_list *)ft_memalloc(sizeof(*files))))
return (-1);
if (!(new_file = (t_file *)ft_memalloc(sizeof(*new_file))))
return (-1);
cursor = ft_lstnew(new_file, sizeof(*new_file));
((t_file *)cursor->content)->fd = fd;
((t_file *)cursor->content)->left_over = 0;
ft_lstadd(&files, cursor);
ret = ft_read_file(fd, cursor->content, line);
}
return (ret);
}

in the .h
#ifndef GET_NEXT_LINE_H
# define GET_NEXT_LINE_H

# define BUFF_SIZE 32
# define EOF "\n"

#include <string.h>

typedef struct s_list
{
void *content;
size_t content_size;
struct s_list *next;
} t_list;

typedef struct s_file
{
int fd;
char *left_over;
} t_file;

The segfault happens with the second call to get_next_line, when if (files) is checked and the program tries to access cursor->content->fd.

files is never set to anything?


It's very rare that you ever really want to use the static keyword in a function or local scope. It's basically the same as moving the declaration into the global scope, which is usually clearer that only one instance of that variable exists. Otherwise, the code looks fine at my glance.

Set a breakpoint at the line it's segfauling and check the cursor and the fd it's trying to access. It looks like it might be going off of the list into random memory, then when you try to look up the fd, you end up in protected memory and segfault.

If you arent using a debugger, then just printf everything in the while loop.
Any sufficiently advanced technology is indistinguishable from magic
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
Last Edited: 2014-11-11 13:40:46
November 11 2014 12:58 GMT
#10884
he guys, Im currently following a community college level app development study and my school is inviting companies in my area so we can get an internship in our last semester.

any tips?

edit, something I did left out was that I have to hold a presentation about a social media website that I made with a group (well.. its more that I did 30% of the work, 1 guy the rest and the others 0 lines of code) are there anythings I should focus on or try to avoid in my presentation?
The harder it becomes, the more you should focus on the basics.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
November 11 2014 16:43 GMT
#10885
--- Nuked ---
nunez
Profile Blog Joined February 2011
Norway4003 Posts
Last Edited: 2014-11-12 08:21:11
November 12 2014 03:23 GMT
#10886
did a quick (and prolly inaccurate) comparison of some different variant implementations. only dispatch, is timed. construction on mine (heap based) is way slower, but only occupies as much memory as it needs to hold the value type it is instantiated with. the implementation of core is amazingly cool i think.

stack based
      jason
      core
      boost
heap based
      jeh

+ Show Spoiler +
#include<iostream>
#include<functional>
#include<memory>
#include<vector>
#include<type_traits>
#include<seq/sequence.hpp>
#include<abstract/abstract.hpp>
#include<abstract/deconstruct.hpp>
#include<../cppcon14/variant.h>
#include<../core/include/core/variant.hpp>
#include<boost/variant.hpp>
#include<seq/seq.hpp>
#define BOOST_VARAINT_MAX_MULTIVIZITOR_PARAMS 5
#include<boost/variant/multivisitors.hpp>
#include<time.h>
#include<random>
#include<pthread.h>

long operator-(const timespec& end,const timespec& start)
{
if ((end.tv_nsec-start.tv_nsec)<0) {
return 1000000000+end.tv_nsec-start.tv_nsec;
} else {
return end.tv_nsec-start.tv_nsec;
}
}


const int N=100000;
const int M=2;

std::random_device rd;
std::default_random_engine e1(rd());
std::uniform_int_distribution<int> dist(0,M-1);

template<int i> struct type{};

template<template<class...> class,class> struct variant_maker;

template<template<class...> class variant,int... index>
struct variant_maker<variant,seq::integer_sequence<index...>>{ using output=variant<type<index>...>; };

template<template<class...> class variant>
using make_variant=typename variant_maker<variant,seq::integer_range<0,M>>::output;

using abstract_t=make_variant<jeh::abstract>;
using jason_variant_t=make_variant<cppcon14::variant::variant_t>;
using core_variant_t=make_variant<core::variant>;
using boost_variant_t=make_variant<boost::variant>;

struct unary_t:boost::static_visitor<void>{
using fn1_t=void();
template<class T>
void operator()(const T&){}
};
unary_t unary;
struct binary_t:boost::static_visitor<void>{
using fn2_t=void();
template<class T,class U>
void operator()(const T&,const U&){}
};
binary_t binary;
struct tetriary_t:boost::static_visitor<void>{
template<class... T>
void operator()(const T&...){}
};
tetriary_t tetriary;

timespec t0,t1;

template<class variant,int i>
variant random_maker(){ return variant((type<i>())); }

template<class variant>
using random_makers_t=std::array<variant(*)(),M>;

template<class variant,int... I>
constexpr random_makers_t<variant> random_makers(const seq::integer_sequence<I...>&){
return {random_maker<variant,I>...};
}

template<class variant>
variant make_random(){
static constexpr auto make_randoms
=random_makers<variant>(seq::integer_range<0,M>());
return make_randoms[dist(e1)]();
}

template<class predicate,class variant>
using dispatch_enabler=std::enable_if_t<std::is_same<variant,predicate>::value,long>;

template<class variant>
dispatch_enabler<jason_variant_t,variant>
timed_unary_dispatch()
{
auto var=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
cppcon14::variant::apply(unary,var);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}

template<class variant>
dispatch_enabler<variant,abstract_t>
timed_unary_dispatch()
{
auto var=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
jeh::deconstruct<void>(unary,var);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}

template<class variant>
dispatch_enabler<variant,core_variant_t>
timed_unary_dispatch()
{
auto var=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
var.visit(unary);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}

template<class variant>
dispatch_enabler<variant,boost_variant_t>
timed_unary_dispatch()
{
auto var=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
boost::apply_visitor(unary,var);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}

template<class variant>
long unary_test(){
std::vector<long> times;
for(int i=0;i<N;++i){
times.push_back(timed_unary_dispatch<variant>());
}
return std::accumulate(std::begin(times),std::end(times),0)/times.size();
}

template<class variant>
dispatch_enabler<variant,boost_variant_t>
timed_binary_dispatch()
{
auto var0=make_random<variant>();
auto var1=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
boost::apply_visitor(binary,var0,var1);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}


template<class variant>
dispatch_enabler<variant,jason_variant_t>
timed_binary_dispatch()
{
auto var0=make_random<variant>();
auto var1=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
cppcon14::variant::apply(binary,var0,var1);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}


template<class variant>
dispatch_enabler<variant,abstract_t>
timed_binary_dispatch()
{
auto var0=make_random<variant>();
auto var1=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
jeh::deconstruct<void>(binary,var0,var1);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}

template<class variant>
long binary_test(){
std::vector<long> times;
for(int i=0;i<N;++i){
times.push_back(timed_binary_dispatch<variant>());
}
return std::accumulate(std::begin(times),std::end(times),0)/times.size();
}

template<class variant>
dispatch_enabler<variant,abstract_t>
timed_tetriary_dispatch()
{
auto var0=make_random<variant>();
auto var1=make_random<variant>();
auto var2=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
jeh::deconstruct<void>(tetriary,var0,var1,var2);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}
template<class variant>
dispatch_enabler<variant,boost_variant_t>
timed_tetriary_dispatch()
{
auto var0=make_random<variant>();
auto var1=make_random<variant>();
auto var2=make_random<variant>();
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t0);
boost::apply_visitor(tetriary,var0,var1,var2);
clock_gettime(CLOCK_THREAD_CPUTIME_ID,&t1);
return(t1-t0);
}

template<class variant>
long tetriary_test(){
std::vector<long> times;
for(int i=0;i<N;++i){
times.push_back(timed_tetriary_dispatch<variant>());
}
return std::accumulate(std::begin(times),std::end(times),0)/times.size();
}


int main(){

std::cout<<"\n---------- unary visit ----------\n\n";
std::cout<<" jason: "<<unary_test<jason_variant_t>()<<std::endl;
std::cout<<" core: "<<unary_test<core_variant_t>()<<std::endl;
std::cout<<" jeh: "<<unary_test<abstract_t>()<<std::endl;
std::cout<<" boost: "<<unary_test<boost_variant_t>()<<std::endl;
std::cout<<"\n------------------------------------\n\n";


std::cout<<"---------- binary visit ----------\n\n";
std::cout<<" jason: "<<binary_test<jason_variant_t>()<<std::endl;
std::cout<<" boost: "<<binary_test<boost_variant_t>()<<std::endl;
std::cout<<" jeh: "<<binary_test<abstract_t>()<<std::endl;
std::cout<<"\n------------------------------------\n\n";

std::cout<<"---------- tetriary visit ----------\n\n";
std::cout<<" boost: "<<tetriary_test<boost_variant_t>()<<std::endl;
std::cout<<" jeh: "<<tetriary_test<abstract_t>()<<std::endl;
std::cout<<"\n------------------------------------\n\n";

}


removed output as it was misleading. i have run it more and varied the the number of types involved in abstraction.
i think final verdict is boost being consistently faster in all cases, core has the slight upper hand on the other two.
jasons is consistently a bit slower than jeh in binary dispatch, but everyone usually within 10 ns of eachother (~220-260 ns).

presonally i'd use the core one (if i wasn't biased towards my own).
conspired against by a confederacy of dunces.
FFGenerations
Profile Blog Joined April 2011
7088 Posts
Last Edited: 2014-11-12 10:59:57
November 12 2014 10:40 GMT
#10887
for a class i have to come up with an idea to research with regards to Distributed Systems....

last night i came up with a draft abstract....by sheer willpower and luck lol :D

have a read and comment if you want....i cant ask any specific questions right now coz im TIRED!

+ Show Spoiler +

(intro)
The Actor model of concurrent processing was inspired by the idea that the core of all computing is the passing of messages. With this as a basis, a decoupling of the sender and receiver of messages allows processes (or Actors) in the Actor model to operate asynchronously. This works to avoid the locking that is required when threads attempt to access data within a traditional shared-state model of concurrent processing.

(abstract)
The Actor Model is an emerging methodology that offers an alternative approach to the traditional shared-state model of parallel programming. Although much debate surrounds the usefulness of the Actor Model in real-world application, this debate tends to surround issues of architectural design rather than runtime performance. This paper aims to evaluate the performance of the Actor Model by measuring the execution time of a scalable multi-threaded application and then comparing this with a similar build based on a traditional shared-state model.


i guess the main obvious questions/steps are

a) how has this been done before? (i doubt it has been done with javascript implementation)
b) how can it be implemented?
c) how can it be implemented in a non-trivial fashion?

for example, will two similar trivial applications in the same programming language but using different code structure show any difference in performance to one another? (feel free to comment on this because I don't know the answer).

how can i make my application scalable to try to uncover differences in performance?

c) how can it be measured?

ok so im not that tired apparently lol


Edit (copy pasta):

With regards to my Final Year Project that several of you advised me on, I firstly proposed to my tutor that I look at a subject in cloud computing but he seemed to immediately dislike the topic, or perhaps he disliked that I hadn't yet come up with something in particular yet and time was ticking...

I then told him about my idea for an anime recommendation website that allows users to generate compositions of anime image covers in order to share these as customised recommendations in JPG form to friends.

He heartily encouraged me to go ahead with it, and since he's the one giving me the grade at the end of the day I couldn't argue too much about it being trivial.

Looking at a few (7?) historic 1st-class projects at Portsmouth, it looks like they get the marks from having solid reports rather than being anything technically magical, so I'm feeling confident about it. I'll put extra work into critically evaluating my design choices, maybe look at bonus functionality, and should get a decent mark.

Maybe I'll post here again with a few questions/ideas with regards to this another time!
Cool BW Music Vid - youtube.com/watch?v=W54nlqJ-Nx8 ~~~~~ ᕤ OYSTERS ᕤ CLAMS ᕤ AND ᕤ CUCKOLDS ᕤ ~~~~~~ ༼ ᕤ◕◡◕ ༽ᕤ PUNCH HIM ༼ ᕤ◕◡◕ ༽ᕤ
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
November 12 2014 11:08 GMT
#10888
On November 12 2014 01:43 Nesserev wrote:
Show nested quote +
On November 11 2014 21:58 sabas123 wrote:
he guys, Im currently following a community college level app development study and my school is inviting companies in my area so we can get an internship in our last semester.

any tips?

edit, something I did left out was that I have to hold a presentation about a social media website that I made with a group (well.. its more that I did 30% of the work, 1 guy the rest and the others 0 lines of code) are there anythings I should focus on or try to avoid in my presentation?

Giving presentations is something that you learn by doing, and of course, you have to know what you're talking about.
The only advice that I could give is:
- make a proper presentation, and keep the viewer in mind
- try not to use live demo's, but rather show everything through step-by-step images or clean videos, and offer hands-on experience afterwards with guidance (if necessary)

Well, you probably will also have the opportunity to present your resume + portfolio. So:
- make a nice resume in LaTeX, use a template; it'll definitely look better than 99.5% of all resumes out there
- make a simple website to present your portfolio of work

thank you!

I will follow your advice.
The harder it becomes, the more you should focus on the basics.
MichaelEU
Profile Joined February 2011
Netherlands816 Posts
November 12 2014 11:56 GMT
#10889
Something that helps improving your presentations is recording yourself and then criticizing yourself (and having others criticize you). It's brutal, but it really works. You'll notice your quirks, pacing, tone of your voice, things you didn't notice stand out, things you thought were glaring are fairly subdued.

Other basic tips: use a lot of different hand gestures, vary your tone, use an image on every slide.
世界を革命する力を!― znf: "Michael-oniichan ( *^▽^*)ノ✩キラ✩"
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
November 12 2014 14:10 GMT
#10890
Fuck xml (in context of reading/writing config files for various Java stuff). Seriously.

/rant
Time is precious. Waste it wisely.
Khalum
Profile Joined September 2010
Austria831 Posts
November 12 2014 14:48 GMT
#10891
On November 12 2014 23:10 Manit0u wrote:
Fuck xml (in context of reading/writing config files for various Java stuff). Seriously.

/rant


Wait what? You don't like having a metric shitton of overhead for even the simplest data serialization? Weirdo.
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
Last Edited: 2014-11-12 15:32:13
November 12 2014 15:30 GMT
#10892
I need to distract myself from this. I can't take it any more...

Poll: Which one do you use?

if (false == somwevar) (1)
 
6%

if (somevar == false) (17)
 
94%

18 total votes

Your vote: Which one do you use?

(Vote): if (false == somwevar)
(Vote): if (somevar == false)



Which and why?

Personally, I prefer to write/see the variable being evaluated before what it's being compared to. Makes more sense syntactically for me as it feels more natural.
Time is precious. Waste it wisely.
delHospital
Profile Blog Joined December 2010
Poland261 Posts
November 12 2014 15:39 GMT
#10893
On November 13 2014 00:30 Manit0u wrote:
I need to distract myself from this. I can't take it any more...

Poll: Which one do you use?

if (false == somwevar) (1)
 
6%

if (somevar == false) (17)
 
94%

18 total votes

Your vote: Which one do you use?

(Vote): if (false == somwevar)
(Vote): if (somevar == false)



Which and why?

Personally, I prefer to write/see the variable being evaluated before what it's being compared to. Makes more sense syntactically for me as it feels more natural.

if (!somevar)
devilesk
Profile Joined May 2005
United States140 Posts
November 12 2014 15:48 GMT
#10894
On November 13 2014 00:39 delHospital wrote:
Show nested quote +
On November 13 2014 00:30 Manit0u wrote:
I need to distract myself from this. I can't take it any more...

Poll: Which one do you use?

if (false == somwevar) (1)
 
6%

if (somevar == false) (17)
 
94%

18 total votes

Your vote: Which one do you use?

(Vote): if (false == somwevar)
(Vote): if (somevar == false)



Which and why?

Personally, I prefer to write/see the variable being evaluated before what it's being compared to. Makes more sense syntactically for me as it feels more natural.

if (!somevar)


I prefer this as well.
www.devilesk.com/dota2
Manit0u
Profile Blog Joined August 2004
Poland17743 Posts
November 12 2014 16:43 GMT
#10895
On November 13 2014 00:39 delHospital wrote:
Show nested quote +
On November 13 2014 00:30 Manit0u wrote:
I need to distract myself from this. I can't take it any more...

Poll: Which one do you use?

if (false == somwevar) (1)
 
6%

if (somevar == false) (17)
 
94%

18 total votes

Your vote: Which one do you use?

(Vote): if (false == somwevar)
(Vote): if (somevar == false)



Which and why?

Personally, I prefer to write/see the variable being evaluated before what it's being compared to. Makes more sense syntactically for me as it feels more natural.

if (!somevar)


I meant it in a more general way. Used false just as an example. This can as well be null, 'somestring' etc.
Time is precious. Waste it wisely.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2014-11-12 16:55:34
November 12 2014 16:52 GMT
#10896
x == 0
For the same reasons.

Though I'm forced to do the opposite at work (for comparision against null). In C#. For C++, 0 == x is less error prone (won't compile if you write 0 = x), but in C# this only really matters in fringe cases.
If you have a good reason to disagree with the above, please tell me. Thank you.
sabas123
Profile Blog Joined December 2010
Netherlands3122 Posts
November 12 2014 18:25 GMT
#10897
(false == somevar) makes no logical sense in normal langauges?
The harder it becomes, the more you should focus on the basics.
Vorenius
Profile Blog Joined December 2010
Denmark1979 Posts
Last Edited: 2014-11-12 18:42:03
November 12 2014 18:41 GMT
#10898
On November 13 2014 03:25 sabas123 wrote:
(false == somevar) makes no logical sense in normal langauges?

Well, unless you are Yoda.

False the variable is.
ZenithM
Profile Joined February 2011
France15952 Posts
Last Edited: 2014-11-12 18:51:53
November 12 2014 18:43 GMT
#10899
Haha was confused for a second about the "if (someboolean == false)".
But yeah, I use: if (blabla == "Hahaha") too. It never works too, I wonder why. Probably something to do with Java. (huehueuglylanguagehue).

Edit: Btw, trolling aside. There is a case to be made for if ("Hahaha".equals(someString)). Allows someString to be null and the comparison doesn't throw a NullPointerException. It may hide a bug though if you weren't expecting a null pointer ;D
Regis
Profile Joined December 2010
Poland109 Posts
November 12 2014 18:58 GMT
#10900
yoyo anyone here use Delphi?
Prev 1 543 544 545 546 547 1032 Next
Please log in or register to reply.
Live Events Refresh
Patches Events
00:00
The 5.4k Patch Clash #17
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech124
NeuroSwarm 103
StarCraft: Brood War
Sea 11786
GuemChi 5833
Leta 220
Mind 159
Zeus 61
Nal_rA 40
Noble 20
Icarus 10
ZergMaN 8
League of Legends
JimRising 734
Counter-Strike
m0e_tv783
Super Smash Bros
hungrybox1389
Other Games
summit1g9725
WinterStarcraft601
C9.Mang0579
monkeys_forever307
ViBE125
amsayoshi39
Organizations
Other Games
gamesdonequick678
StarCraft: Brood War
UltimateBattle 50
Dota 2
PGL Dota 2 - Main Stream48
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1246
• Lourlo1168
Upcoming Events
Replay Cast
3h 49m
Afreeca Starleague
4h 49m
Jaedong vs Light
Wardi Open
5h 49m
Monday Night Weeklies
10h 49m
Replay Cast
18h 49m
Sparkling Tuna Cup
1d 4h
Afreeca Starleague
1d 4h
Snow vs Flash
WardiTV Invitational
1d 5h
SHIN vs Nicoract
Solar vs Nice
GSL
2 days
Classic vs Cure
Maru vs Rogue
GSL
3 days
SHIN vs Zoun
ByuN vs herO
[ Show More ]
OSC
3 days
OSC
3 days
Replay Cast
3 days
Escore
4 days
The PondCast
4 days
WardiTV Invitational
4 days
Zoun vs Ryung
Lambo vs ShoWTimE
Replay Cast
4 days
CranKy Ducklings
5 days
RSL Revival
5 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
5 days
Krystianer vs TriGGeR
Cure vs Rogue
uThermal 2v2 Circuit
5 days
BSL
5 days
Replay Cast
5 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
6 days
BSL
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

YSL S3
Escore Tournament S2: W6
KK 2v2 League Season 1
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.