To which direction do you see the curly braces pointing?
πŸ‘︎ 1k
πŸ’¬︎
πŸ‘€︎ u/crandalljft
πŸ“…︎ Dec 31 2021
🚨︎ report
Benefit of curly braces ws '='

I understand that '=' operator canby default sometimes lead to unwanted data-narrowing, which can be avoided by using {} syntax instead.

However, when compiling code with /W4 and /WX, any such occasion would AFAIK throw compiller error anyway, wouldn't it?

So is there any benefit of using syntax as:

bool x{true};
int i{0};

compared to the older (but IMHO more readable):

bool x = true;
int i = 0;

I've tried to find the answer, but every discussion seems to only consider default behavior without the level-4 warnings enabled.

πŸ‘︎ 31
πŸ’¬︎
πŸ‘€︎ u/adenosine-5
πŸ“…︎ Jan 15 2022
🚨︎ report
Semicolons and curly braces (Python vs C++/Rust)

I've used Python for many years, and am quite subjective in my view that curly braces and semicolons are unnecessary when you can do without them. Code seems more readable that way. Now, I understand that C++ has its own history and syntax choices made a long time ago but I was surprised to learn that a more "recent" language Rust also uses this type of syntax.

Please help me understand or link any good sources: are there technical or non-technical reasons why curly braces and semicolons would be preferred over say newlines and indentation? (apart from being able to format source code like a donut) Could one, hypothetically, reimplement say Rust language with just changing semicolons to newlines?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/Fanndonald
πŸ“…︎ Jan 17 2022
🚨︎ report
Wrap curly braces around a block of code

Hi,

I wonder how I can wrap curly braces around a block of code efficiently. For example, in the situation below,

https://preview.redd.it/l85ls7h4sp781.png?width=372&format=png&auto=webp&s=4aa1196d291f866e3a88e076e465ab7704b73b59

I want to insert curly braces like this:

https://preview.redd.it/xpxo5labsp781.png?width=418&format=png&auto=webp&s=f5142d12d0f26f01abb3ba04ca252fb2a2d0327d

However, when I try to insert the closing bracket, if there is another closing bracket below, vim will jump to that bracket instead of inserting a new one:

https://preview.redd.it/zn0aqetksp781.png?width=468&format=png&auto=webp&s=ae3bcc07f93f115ffe6b790867ebd66a2f2e945e

I've done some research online and found no satisfying result. Can anyone provide a solution? Thanks a lot! Merry Christmas :D

πŸ‘︎ 13
πŸ’¬︎
πŸ‘€︎ u/MVP_Harry
πŸ“…︎ Dec 25 2021
🚨︎ report
Curly Brace
πŸ‘︎ 201
πŸ’¬︎
πŸ‘€︎ u/residentbevo
πŸ“…︎ Dec 27 2021
🚨︎ report
Does curly brace scopes get resolved at compile time in C?
int main(void)
{
    // something

    {
        int tmp;
        // using tmp
    }

    // something
}

All I need is the ability to hide the name tmp. I expect the compiler to simply move all the declaration at the beginning of the function. And use name mangling for preventing access to tmp outside the scope. Is this not true? Does this have any runtime performance cost if used a lot in a single function?

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/AwkwardEmu994
πŸ“…︎ Jan 10 2022
🚨︎ report
Curly braces formatting

Hello! A few days ago i talked about the formatting of the curly braces in C# with my teacher.

as you know there are the following two possibilities:

if (condition) 
{
    DoSomething();
    //I know one lined If-statements don't need braces. . .
} 
if (condition) {
    DoSomething();
    //I know one lined If-statements don't need braces. . .
} 

Both work. The "auto format" tool of our IDE (SharpDevelop) formats it like the second example but my teacher says the first one is better.

What do you think? Which do you use?

πŸ‘︎ 14
πŸ’¬︎
πŸ‘€︎ u/Emmet_03
πŸ“…︎ Nov 23 2021
🚨︎ report
Export-Csv and the curly braces

Folks, I come to you with the tail between my legs .... I have been banging my head against the wall for quite a while.I am modifying a very simple script which dumps user account related info from Azure. One of the columns contains curly braces (which should get exported into the csv file). Out-GridView displays the "Licenseinfo" column (the column contains curly braces {} ) just fine and the CSV file contains the system related abracadabra.

Ideas?

************************************************************

Write-Host "Finding Azure Active Directory Accounts..."
$Users = Get-MsolUser -All | ? { $_.UserType -ne "Guest" } 

$Report = [System.Collections.Generic.List[Object]]::new() # Create output file
Write-Host "Processing" $Users.Count "accounts..." 
ForEach ($User in $Users) {
    $MFAEnforced = $User.StrongAuthenticationRequirements.State
    $MFAPhone = $User.StrongAuthenticationUserDetails.PhoneNumber
    $islicensed = $User.islicensed
    $Licensed = $User.Licenses
    $BlockCredential = $User.BlockCredential
    $WhenCreated = $User.WhenCreated
    $LastPasswordChangeTimestamp = $User.LastPasswordChangeTimestamp
    $DefaultMFAMethod = ($User.StrongAuthenticationMethods | ? { $_.IsDefault -eq "True" }).MethodType
    If (($MFAEnforced -eq "Enforced") -or ($MFAEnforced -eq "Enabled")) {
        Switch ($DefaultMFAMethod) {
            "OneWaySMS" { $MethodUsed = "One-way SMS" }
            "TwoWayVoiceMobile" { $MethodUsed = "Phone call verification" }
            "PhoneAppOTP" { $MethodUsed = "Hardware token or authenticator app" }
            "PhoneAppNotification" { $MethodUsed = "Authenticator app" }
        }
    }
    Else {
        $MFAEnforced = "Not Enabled"
        $MethodUsed = "MFA Not Used" 
    }
  
    $ReportLine = [PSCustomObject] @{
        User        = $User.UserPrincipalName
        Name        = $User.DisplayName
        MFAUsed     = $MFAEnforced
        MFAMethod   = $MethodUsed 
        PhoneNumber = $MFAPhone
        BlockCredential = $BlockCredential
	Licensed      = $islicensed
        LicenseInfo    = $Licensed
        WhenCreated = $WhenCreated
	LastPasswordChangeTimestamp = $LastPasswordChangeTimestamp
        
    }
                 
    $Report.Add($ReportLine) 
}

W
... keep reading on reddit ➑

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/dudster1964
πŸ“…︎ Dec 31 2021
🚨︎ report
Why does VSCode autocompletes double quotes instead of curly braces on on:click?

Trying out Svelte and on:click event.

VScode offers autocomplete on:click but it writes doble quotes instead of curly braces: https://i.imgur.com/nLYBT3M.png

Why is that and how to make it curly braces?

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/CatolicQuotes
πŸ“…︎ Dec 27 2021
🚨︎ report
Added Curly Brace too!
πŸ‘︎ 138
πŸ’¬︎
πŸ‘€︎ u/Ryanizawsum
πŸ“…︎ Dec 01 2021
🚨︎ report
How do you turn on almond style curly braces(Visual Studio)?

Edit. Allman style!!!!

πŸ‘︎ 12
πŸ’¬︎
πŸ“…︎ Dec 08 2021
🚨︎ report
multiple ' .' delimited strings within curly braces

regex flavor: JavaScript

Using regex vs splitting isn't my decision, see bottom for background.


Noting matched strings are effectively \S:

  • .fizz { .foo .bar } .buzz should match foo, bar, not .foo,.bar not including fizz/buzz,

  • fizz{.foo .bar}buzz also matches foo, bar

  • {.foo.bar} should match foo.bar


  • Split lines are malformed input / user error: (preview is showing this on one line, unformatted, no matter what i try...)

    { .fizz .buzz }

BUT could match fizz. So, [}|\n|\r] as a closing delimiter ? Not a priority.

  • Nested curlies are erroneous input / user error:

{.fizz.bu{}zz}

Indeterminate output / stack overflow / out of memory / BSOD is OK.


One of many, many attempts: https://regex101.com/r/3s9GQL/1

I was going to include some of my steps/reasoning, but even as i type things out i have so many 'what if' ideas and noting what may or may not be flaws - this post would be a novel. (One such thing i've noticed since pasting the link: combining multiline/begin+end anchors with .* at each end of the regex.)

I've spent a couple hours a day over the past week trying new things each time but what can i say, i suck at regex. I understand the visualizations on regexr/regex101, mostly grasp the cheat-sheets and basic howtos. Nontrivial howtos with visualizations (vs just a wall of text) is something i haven't come across...

Any help/tips appreciated !


Background/Context:

Using the Generic Attributes extension for .NET's Markdown library, Markdig, we can attach ids, classes, etc, to elements. For instance:

# Heading { .text-blue-500 .italic .hover:bg-[#deadbeef] }

becomes

<h1 class="text-blue-500 italic hover:bg-[#deadbeef]">Heading</h1>

https://github.com/xoofx/markdig/blob/master/src/Markdig.Tests/Specs/GenericAttributesSpecs.md

Tailwind CSS lets us specify a regex to be used for extracting class names for a given filetype:

https://tailwindcss.com/docs/content-configuration#customizing-extraction-logic

Using the default extraction regex picks up on some, but not all of the classes specified presumably because of the leading '.'.

Above the linked section it is mentioned that "it often makes sense to compile that content to HTML before scanning it for class names" but my project is using Markdig to render markdown in-browser for local development. (Embedding converted HTML when deployed.) Taking advantage of custom extraction logi

... keep reading on reddit ➑

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/McNerdius
πŸ“…︎ Dec 28 2021
🚨︎ report
Docker-compose: How can I use {curly} braces inside a parameter?

`paperless-ng` has a configuration file that is not used in Docker mode; instead, the parameters need to be provided as docker environment variables. So far so good! Except that one parameter requires curly braces.

Curly braces are part of the YAML syntax, so to use them inside a value of a Docker environment variable, these braces need to be escaped. Below is a simplified part of the Docker compose that I have in Portainer. The whole thing works fine except that the last line below is plainly ignored. (In the actual file, there are more lines after.)

--> How can I escape the curly braces in the last line?

services:
  database:
    foo: bar
    blah: baz
  webserver:
    image: jonaswinkler/paperless-ng
    depends_on:
      - database
    ports:
      - 12345:80
    volumes:
      - /foo:/bar
    environment:
      PAPERLESS_FOO: bar
      PAPERLESS_LANGUAGE: eng
      PAPERLESS_FILENAME_FORMAT: "{created_year}/{correspondent}/{title}"
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/FinibusBonorum
πŸ“…︎ Dec 19 2021
🚨︎ report
The amount of self-image stuff that cartoons made fun of constantly and got into us is staggering. Braces, inhalers, glasses, unibrows, baldness, weight issues, curly hair. No wonder kids got constantly bullied in school, because no one couldn't be absolutely perfect.
πŸ‘︎ 30
πŸ’¬︎
πŸ‘€︎ u/altsam19
πŸ“…︎ Nov 19 2021
🚨︎ report
what does commands mean inside curly braces?

I have seen sometimes that some people write commands inside curly braces { command one; comands two } | command

what does it do anyway?

πŸ‘︎ 17
πŸ’¬︎
πŸ‘€︎ u/nimo_xhan
πŸ“…︎ Nov 10 2021
🚨︎ report
Just beated Curly Brace, and now, you know what it comes (after getting her panties)

Should i trade Polar Star?

View Poll

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/XarlesEHeat
πŸ“…︎ Oct 31 2021
🚨︎ report
Swift vs Swift UI for loops: not even the curly brace is the same
πŸ‘︎ 625
πŸ’¬︎
πŸ‘€︎ u/SeesawMundane5422
πŸ“…︎ Jul 21 2021
🚨︎ report
Curly Brace fanart
πŸ‘︎ 124
πŸ’¬︎
πŸ‘€︎ u/5Kayarma
πŸ“…︎ Sep 21 2021
🚨︎ report
Why are curly braces marked as errors if they're inside parentheses?

I made a very simple #define macro in C with curly braces inside parentheses, and even though the compiler doesn't give any errors or warnings, even with all warning flags turned on, vim still decides that the braces should be highlighted in red. Below I have pasted the code in question.

#define vectorFromComponents(x, y) ((Vector) { \  
    x, \  
    y, \  
    hypot(x, y), \  
    atan2(y, x) \  
})
πŸ‘︎ 13
πŸ’¬︎
πŸ‘€︎ u/FintasticMan
πŸ“…︎ Nov 08 2021
🚨︎ report
Added Curly Brace too!
πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/Ryanizawsum
πŸ“…︎ Dec 01 2021
🚨︎ report
<Curly Brace Gaming>
πŸ‘︎ 38
πŸ’¬︎
πŸ‘€︎ u/Wingdings_Master
πŸ“…︎ Nov 18 2021
🚨︎ report
Coming from a mostly php/js background gdscript is strange to me because of the lack of curly braces.

I'm planning to jump into godot4, I have played with the engine previously, I found the lack of curly braces made looking at function scope and logic nesting to be a bit cumbersome. Is there a way I can use gdscript and still have my curly braces? gdscript is somehow related to python right? Curly braces are optional in python?

Either way, I welcome any and all editor tweaks I could do to help with code formatting and comprehension.

Cheers.

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/wh33t
πŸ“…︎ Oct 07 2021
🚨︎ report
Was expecting CURLy braces
πŸ‘︎ 36
πŸ’¬︎
πŸ‘€︎ u/OmegaNutella
πŸ“…︎ Nov 05 2021
🚨︎ report
Trouble with nested curly braces in Jinja2?

So the code where the issue occurs looks like:

&lt;a href="{{ url_for('download_file', filename='{{original_filename}}_{{loop.index}}.jpg') }}"&gt;

The issue is that it's processing the inner curly braces as literal curly braces, not as Jinja syntax. How do I avoid this? How do I put Jinja variables inside of a Jinja variable?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/Missing_Back
πŸ“…︎ Oct 21 2021
🚨︎ report
How to use double curly braces in blade

Hi, I'm still new to laravel, I am just wondering what data is being pulled and from where when using the double curly braces.. if I have a {{ $variable }} within example.blade.php, where would this $variable be within the laravel file? I remember an instance of using a variable from a model I believe but I can't be sure. Any help would be appreciated.

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/AudioOscillator
πŸ“…︎ Oct 02 2021
🚨︎ report
Was expecting CURLy braces
πŸ‘︎ 18
πŸ’¬︎
πŸ‘€︎ u/OmegaNutella
πŸ“…︎ Nov 05 2021
🚨︎ report
hardcode C/C++ indentation level at a specific line on a per-file basis / ignore certain curly braces

i am working on C++ source that uses no indentation for C++ namespace. is there a way to add a comment in the file to tell emacs that at that particular line it should assume the indentation level to be at zero or to ignore specifically marked curly braces?

i do not want to configure namespace indentation in general and i do not want to know how to do it (non-portable) with the help of lisp in my own configuration file.

is there magic which can be added in comments to affect indentation on the fly?

πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/bunky_bunk
πŸ“…︎ Oct 16 2021
🚨︎ report
Was expecting CURLy braces
πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/OmegaNutella
πŸ“…︎ Nov 05 2021
🚨︎ report
Was expecting CURLy braces
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/OmegaNutella
πŸ“…︎ Nov 05 2021
🚨︎ report
What do returning curly braces mean in this case?
πŸ‘︎ 26
πŸ’¬︎
πŸ‘€︎ u/leilanabil
πŸ“…︎ Aug 15 2021
🚨︎ report
and here it is, our protector of mimigas, curly brace, anyway, thank you for welcoming me :D, you made me very happy, seriously, thank you so much
πŸ‘︎ 34
πŸ’¬︎
πŸ‘€︎ u/Kaynatea4
πŸ“…︎ Sep 01 2021
🚨︎ report
Curly Brace is the best girl, and this is not a debate (by Me)
πŸ‘︎ 169
πŸ’¬︎
πŸ‘€︎ u/Frozen_Ape_Art
πŸ“…︎ Jul 14 2021
🚨︎ report
VS Code deletes my Jinja expression curly braces when pressing enter after the closing '%}'
πŸ‘︎ 30
πŸ’¬︎
πŸ‘€︎ u/schroeder8
πŸ“…︎ Jul 20 2021
🚨︎ report
[OC] Curly Brace in a different style!
πŸ‘︎ 40
πŸ’¬︎
πŸ‘€︎ u/GatoradeGrenade
πŸ“…︎ Aug 07 2021
🚨︎ report
Why don't Haskell functions require curly braces or return statements?

New to Haskell and going through tutorials, trying to understand how Haskell knows where functions begin and end witgout braces.

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/mczarnek
πŸ“…︎ Jul 27 2021
🚨︎ report
You can write curly braces properly
πŸ‘︎ 217
πŸ’¬︎
πŸ‘€︎ u/AH50
πŸ“…︎ Sep 05 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.